|
-
Jun 6th, 2005, 11:38 AM
#1
Thread Starter
Fanatic Member
C# Problem
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());
}
-
Jun 6th, 2005, 10:12 PM
#2
Re: C# Problem
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:
VB Code:
try
{
Application.Run(new MainForm());
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
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.
-
Jun 6th, 2005, 10:56 PM
#3
Lively Member
Re: C# Problem
Ya Try to Get more clear Message...........
-
Jun 15th, 2005, 06:24 PM
#4
Frenzied Member
Re: C# Problem
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|