|
|
Do you really expect us to count the lines?
Highlight (put in bold) or mark with comment or even repeat the line that gives the error.
|
|
|
|
|
Oh! You mean that TINY little comment on the end of the line?? The one that got cutoff because the line was too big to fit on the monitor I was on??
OK, I'll say it again. Nowhere in this code is "args" defined. So, the error is correct. You're using "args" in that line you barely pointed out, but nowhere in this section of code did you define it.
|
|
|
|
|
RogerLum wrote: BinaryWriter writer = new BinaryWriter(new FileStream(args[0], FileMode.OpenOrCreate, FileAccess.Write)); //line 81
Why did you use arg[0] and never specified the value in the first place?
8.Kelvin()
{
while (!(the machine can program itself))
Wont_stop_coding = true;
}
|
|
|
|
|
8kelvin wrote: Why did you use arg[0] and never specified the value in the first place?
8.Kelvin(){ while (!(the machine can program itself)) Wont_stop_coding = true;}
like i said,
i have little knowledge of c#, and therefore coming to learn over here, if not i won't be even asking in this forum at all.
|
|
|
|
|
RogerLum wrote: i have little knowledge of c#
Then why are you choosing such a complex task to learn C# ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
I'm assuming that since you never declared the arg variable that it's the commend line arguments you want here.
Use:
Environment.GetCommandLineArgs().GetValue(1).ToString();
|
|
|
|
|
By the look of things, you've copy pasted some code from an example, without really understanding it.
in your example, args[] was probably the values from the command line. It doesn't look like you've got a command line application here, and the args[] array doesn't automagically propogate itself around the program - you'd need to copy it into a member variable, or pass it as an argument into your functions.
In this case, you need to replace the bit that reads "args[0]" with the filename you want to save the image to,
|
|
|
|
|
ok so I'm using
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = false)]
static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam);
to click at a location on a WebBrowser object in my program
it's working fine for regular websites, but when I try to use it to click onto a site which is a flash program it doesn't register as having clicked
I don't know where the error is occuring but the site doesn't know that it's been clicked in this case
any tips?
|
|
|
|
|
If your'e trying to click inside a Flash object, it won't work. SendMessage only sends messages Win32 window handles. Since Flash isn't a window in the Win32 sense, nothing will happen.
|
|
|
|
|
You'll probably need to SendMessage to the actual Flash ActiveX object on the page. ActiveX controls are their own Win32 windows in IE (and hence, the WebBrowser control). Other controls like buttons are not real Win32 windows, which would explain why doing a SendMessage would work on those controls, but not on ActiveX.
Religiously blogging on the intarwebs since the early 21st century: Kineti L'Tziyon
Judah Himango
|
|
|
|
|
oh, thats not as easy as I expected
is there some other way to just send a click to a certain coordinate inside my webbrowser?
and hopefully something that can work with a minimized window sort of thing
|
|
|
|
|
hello
I cast an instance member to an interface (IAddress), then pass it as "ref" to a method. Seems like after method returns the "interface" oAddress contains valid address loaded from database, while the original instance's member remains null - how can that happen..?
<br />
public class DAO<br />
{<br />
...<br />
public void DAO.LoadParentAddress(ref IAddress oAddress)<br />
{<br />
...<br />
oAddress = ....;<br />
...<br />
}<br />
...<br />
}<br />
<br />
public class Program<br />
{<br />
...<br />
public void main(...)<br />
{<br />
...<br />
DAO oDAO = new DAO(...);<br />
IAddress oAddress = (IAddress) Person.ParentAddress;<br />
oDAO.LoadParentAddress(ref oAddress);<br />
<br />
Assert.IsNotNull(oAddress);
Assert.IsNotNull(Person.ParentAddress);
}<br />
...<br />
}<br />
dev
|
|
|
|
|
oAddress is passed by reference, so its 'address' is passed to your DAO. When the DAO creates a new object, it passes the 'address' of this object back to the 'client' - so the address pointed to by oAddress correctly points to the data crerated by the DAO...
But the address pointed to by Person.ParentAddress hasn't changed.
Change
IAddress oAddress = (IAddress) Person.ParentAddress;<br />
oDAO.LoadParentAddress(ref oAddress);<br />
to
oDAO.LoadParentAddress(ref (IAddress)Person.ParentAddress);
to achieve what you want.
IN case I am not clear (it's late and Friday and I am gagging for a beer)
BEFORE:
Person.ParentAddress points to memory location 1234
oAddress points to memory location 1234
call o DAO
oAddress points to memory location 2345
Person.ParentAddress points to memory location 1234
___________________________________________
.\\axxx
(That's an 'M')
|
|
|
|
|
Thanks, and sorry I think my example mislead you...
public void DAO.LoadParentAddress(ref IAddress oAddress)
{
...
// load parent address from database, this is fine, i see oAddress been assigned to correctly.
oAddress.StreetAddres = "123 Wallstreet";
oAddress.ZipCode = "93N2V7";
...
}
...
}
it did not actually reassign oAddress to point at another memory location or allocate a "new" address.
I also tried ...
oDAO.LoadParentAddress(ref (IAddress) oPerson.ParentAddress));
Compiler didn't like it.
I think it is some deep recursive voodo inside the method... The example I gave is a simplified version of the object graph i'm working with... I do detect before/after function exit
*oAddress != *oPerson.ParentAddress
I'm still looking for why.
thanks for your help though.
dev
|
|
|
|
|
devvvy wrote: IAddress oAddress = (IAddress) Person.ParentAddress;
There's your problem - you're passing the local variable oAddress by reference, and not the field itself. And no, the compiler doesn't allow you to pass a property by reference. You could either pass the Person object itself to the LoadParentAddress method, or initialize the reference in main and have the LoadParentAddressMethod fill data in the object (instead of creating and assigning a new one).
|
|
|
|
|
Hi guyz i am working on an ftp application need to know how to upload a file.
i am having a trouble at
Stream ftpstream = ftp.GetRequestStream();
error is
The remote server returned an error: (550) File unavailable (e.g., file not found, no access)..
modified on Thursday, March 26, 2009 9:56 PM
|
|
|
|
|
I'm getting the above exception where the heading for the Stack Trace is: {"The specified module could not be found. (Exception from HRESULT: 0x8007007E)":null}
This is a windows application using c#.net 2008, and the code is as follows:
private void formEmergePatDB_Load(object sender, EventArgs e)
{
// more code here ........
populate_Images(0, 19); //FileNotFoundException error on this line
{
public void populate_Images(int startImg, int endImg)
{
int img = 0;
// more code here ........
{
Before the populate_Images error the code performs many other similar requests with no problem?
I can't imagine why it can't find the module, it is there and I am sending the appropriate arguments it asks for. Help Anyone!!!
|
|
|
|
|
i think its a memory error not sure.
|
|
|
|
|
Can you paste us the contents of your populate_Images function?
|
|
|
|
|
Hi,
lacking some of the essential information, here is a wild guess: populate_Images() is called successfully, but it contains either a reference to native code using P/Invoke, and some method is not found, or, more likely, it attempts to locate images from external modules (say DLL files) and one of them cannot be found. Check for a typo. Or show us the code; if you do PLEASE use the "code block" button below the edit window.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Thanks Luc for your help with this, and everyone else that is trying. Thing is, I have a break point on the 1st line of populate_Images routine, which is a simple var declaration, and that code never fires. The error actually happens on the calling line populate_Images(0, 19);
Is it possible to error before it calls the routine? You are correct Luc, the routine uses ImageMagick to render the .pcx images onto 23 or so imageBoxes per page. Code is too much to post here, but here is a portion that uses imageMagick:
public void populate_Images(int startImg, int endImg)
{
int img = 0;
etc, etc..............................
for (intI = startImg; intI <= endImg; intI++)
{
var imageList = new ImageMagickNET.ImageList();
img += 1;
string strIm1 = "\\\\swd4fs\\graphics\\" + (commonClass.parseIt(FileListBox.Path.ToString(), "Release")) + "\\";
string strIm2 = FileListBox.SelectedIndex.ToString();
imageList.ReadImages(strIm1 + strIm2);
foreach (ImageMagickNET.Image image in imageList)
{
switch (img)
{
case 1:
PictureBox1.Image = image.ToBitmap();
break;
case 2:
PictureBox2.Image = image.ToBitmap();
break;
case 3:
PictureBox3.Image = image.ToBitmap();
break;
etc, etc..............................
}
break;
}
}
imgaMagick works great in vs2005, been have lots of trouble integrating into vs2008.
Thanks for your help
|
|
|
|
|
Hi,
Member 4622089 wrote: THIS LINE HAS GIVEN ME TROUBLE THRU THE ENTIRE PROJECT
tells me you are doing something wrong and have chosen to live with it.
you should solve this.
Member 4622089 wrote: BREAK POINT HERE : NEVER BREAKS
I don't trust breakpoints that much. I prefer adding log statements to see the program evolving.
the simplest log method is Console.WriteLine(string);
If you don't need img right away the compiler might have moved it downwards.
You are omitting to much code for us to help you.
I suggest you start by adding a try{...} catch(Exception exc) {Console.WriteLine(exc.ToString());} first at the caller to populate_Images as well as inside populate_Images.
Is it the first call to populate_Images that fails? is any image processed correctly before it fails?
does it fail consistently?
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Luc, your assumptions are incorrect. I have not chosen to live with it, I am currently attempting to get it to work. I need to render .pcx images and don't have another way of doing it in .NET, so I found imageMagick, which worked great in 2005 for over a year, and thought I'd be able to get it to work in 2008...it is what I am trying to solve.
Breakpoints never gave me trouble, ever... the code never hits the module, it errors on it's call, therefore I'm not sure if it is imageMagick or something else.
The code I'm omitting is just setting variables as flags, checking other flags for setting a tab panel control, clearing the imageBoxes, and redering 23 images instead of the few I actually posted. The code simply never gets to this routine at all. It is the populate_Images call that fails, consistently and it is the first call to this routine (which at this point is done on my initial page load). No images are rendered at this point, that is what the populate_Images routine does.
Thanks for all your help
|
|
|
|
|
OK,
1.
something cannot be right. populate_Images() is a regular C# method, it is part of your code, so it does not need another file and it can't be missing or not be found. It can only go wrong inside populate_Images(). So I would add a log statement inside and see it gets executed.
BTW what where the results from the try-catch?
2.
ImageMagick is a library and optionally also an ActiveX component isn't it?
When you install it, there are several checkboxes, one of them makes it available as an ActiveX component, did you check it during installation?
3.
Is GetList() the first call into ImageMagick? Doesn't the library need some initialization? What is inside the ImageMagick constructor? Is the constructor your code, or is there a .NET wrapper available publicly?
4.
Maybe something went wrong with its referencing, so I suggest you:
- remove all ImageMagick stuff from your project (and from the GAC if you use it)
- comment out the calls to it
- re-add a reference to it
- retype the statements using IM while watchinh intellisense works for it.
-
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|