Error Starting APP in the GDI

J

jcrouse

I moved a bunch of code and variable declaration around to make things a
little more efficient. Now when i try and run the app I get the following
error:

An unhandled exception of type 'System.NullReferenceException' occurred in
Unknown Module.
Additional information: Object reference not set to an instance of an
object.

The problem is that i can't debug it. I have put breakpoints everywhere and
can't find the problem. In my startup module everything seems to initialize
properly. I then run the following code:

Application.Run(frm1)


Inside the load event for this form i step through everything and it all
seem good. Here is the load event:

Private Sub Form1_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Load

Dim strFiles() As String =
Directory.GetFiles(Application.StartupPath & "\Layout Files")

If strFiles.Length > 0 Then

mnuMainNewConfig.Enabled = True

End If

bSaveTrigger = False

frm1.strExitKey = ""

End Sub


I get all the way through to the end sub then when i click the "step into"
button the error occurs. I don't know how to debug deeper or what to do
next. Please help.

Thank you,
John
 
J

jcrouse

More....When I select the break button, I get the following error:

There is no source code available for the current location.



I'm sure I moved something wrongly, I just don't know how to find out what.



Thnaks again,

John
 
J

jcrouse

Well....I seem to have found it. This piece of code was wrong:

If strMyStartupArguments.Length = "1" Then

If frm1 Is Nothing OrElse frm1.IsDisposed Then

frm1 = New Form1

End If

myForms.form1 = frm1

Application.Run(frm1)

Exit Sub

End If


I needed to read like this:

If strMyStartupArguments.Length = "1" Then

If frm1 Is Nothing OrElse frm1.IsDisposed Then

frm1 = New Form1

End If

Application.Run(frm1)

myForms.form1 = frm1

Exit Sub

End If


Can someone explain this so I understand?

Thank you,
John
 

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