My App was running OK. But i am getting this error when i try tro run it.
An unhandled exception of type 'System.NullReferenceException' occurred in
system.windows.forms.dll
This is the code
static void Main()
{
Application.Run(new MainForm());
}
Printable View
My App was running OK. But i am getting this error when i try tro run it.
An unhandled exception of type 'System.NullReferenceException' occurred in
system.windows.forms.dll
This is the code
static void Main()
{
Application.Run(new MainForm());
}
I doubt that this is actually the code that is throwing the exception. Assuming that there is no bug with VS, I would guess that execution is entering the MainForm constructor and your exception is being thrown somewhere in there. Try this code:When the exception is thrown you should get a message box that shows a call stack to the point where the exception occurred. This may help you to narrow it down.VB Code:
try { Application.Run(new MainForm()); } catch (Exception ex) { MessageBox.Show(ex.ToString()); }
Ya Try to Get more clear Message...........
post your code for the forms Load() event...i've seen this happen in one of my programs...at load, a database connection wasnt getting made and got the same error...damn network guys LOL