strange problem with dlg.ShowDialog(); - Help !!!

G

Guest

Hello,

i'm having a problem with the following code:

if (m_is_it_exist==1) // if the weapon is in the mlay and can be sold
{
PrintCustShtarBuy pd=new PrintCustShtarBuy(this.mf,this);
PrintPreviewDialog dlg = new PrintPreviewDialog() ;
dlg.Document = pd;
dlg.ShowDialog();
}

the problem is that even if m_is_it_exist==0, it still trying to run the line:
dlg.ShowDialog();
i put this part in try{} catch{} and everytime it goes to the catch because
the program run only this line without running the lines before in that
specific if part.

What could be the problem?

thanks....
 
I

Ignacio Machin \( .NET/ C# MVP \)

hi,

That's super weird , Is the code you posted the one you are running? or just
a piece of it?
post the full code as it's in the program.

cheers,
 
G

Guest

Are you sure this is a problem with the showdialog().
Looks more like its with the comparison you are doing. If your code jumps to
the catch block, it shows something's wrong. what's the error message you get
from the catch block?

is m_is_it_exist a boolean or a numeric type?
Look at that. I think you are assuming its one of these, but it is in fact
the other.


hope this helps a bit.
 
C

cody

It seems to be that the debugger is fooling you. A program cannot run to a
line without executing the previous lines. Delete the bin and obj folders
and make a complete rebuild, the problem should go away then.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top