Click here to Skip to main content
15,885,985 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,

I am working on C# winform.

I created a form and started coding, in the form load I wrote Messagebox.Show ("Hi") and also putted the break point in the load.

Its effecting the form now. Its not displaying the message box and I can't do the debugging.

Please help me.

I need urgent.
Posted
Updated 10-Jan-12 20:49pm
v2

It's difficult to tell what is going on from such a brief description, but at a guess:

Your breakpoint is on or before the MessageBox Statement. When you set a breakpoint, the debugger stops executing at the beginning of that statement. So if you have three lines:
C#
int i = 1;
MessageBox.Show("Hi");
int j = i * 2;
And you set a breakpoint of the MessageBox line, the "i = 1" statement will be executed, and then the debugger will stop executing, before the Message box is shown.

Run your program, and when the breakpoint occurs, use the "Step Over" button (or press F10) to execute a single statement.

If this isn't the problem, then we need more details to be able to help.
 
Share this answer
 
Comments
Narayan Shanubhog 11-Jan-12 3:13am    
Hi,

acutally whatever i written previously in form load event code is working.. but now added some code like messagebox.show("Hi") etc ..but its not showing the message box when the form load.. other operation is working fine.. and also now i cant debugg of that form..
OriginalGriff 11-Jan-12 3:23am    
Three things to check:
1) Did you compile your code? Try CTRL+SHIFT+B and see if that helps.
2) Are you building the release version? On the menu bar there should be a drop down with Debug or Release in.
3) Are you executing your code through the debugger? Use F5 to run it, not SHIFT+F5
Hi,

Put the break point at curly braces...

C#
private void Form1_Load(object sender, EventArgs e)
{
    //MessageBox.Show(this, "Hi");
    MessageBox.Show("Hi"); 
}


this is functioning...
what's the problem?

Regards,
 
Share this answer
 
Comments
Narayan Shanubhog 11-Jan-12 3:14am    
acutally whatever i written previously in form load event code is working.. but now added some code like messagebox.show("Hi") etc ..but its not showing the message box when the form load.. other operation is working fine.. and also now i cant debugg of that form..
Al Moje 11-Jan-12 3:30am    
Try to use
overloaded function:
MessageBox.Show(this, "Hi");
How do you create your FormLoad Event ?

I think you'd better double click yours form window create yours event , and add your source in new on
 
Share this answer
 
Comments
Narayan Shanubhog 11-Jan-12 3:14am    
acutally whatever i written previously in form load event code is working.. but now added some code like messagebox.show("Hi") etc ..but its not showing the message box when the form load.. other operation is working fine.. and also now i cant debugg of that form..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900