A first chance exception of type 'System.NullReferenceException' occurred in myapp.exe

  • Thread starter Thread starter GS
  • Start date Start date
G

GS

why am i getting
A first chance exception of type 'System.NullReferenceException' occurred in
myapp.exe

below? and what can i do get rid of it?

Private Function getPrefxType() As String
If bSkipGetListBOxComboBoxValue Then Return ""

Try
getPrefxType = DropListPreFxType.SelectedValue.ToString '
<<error
' the above line gives
'A first chance exception of type
'System.NullReferenceException' occurred in myapp.exe
Me.setStatus("OK")
Catch ex As Exception
If DropListPreFxType.SelectedIndex < 0 Then
DropListPreFxType.SelectedIndex = 0
'MsgBox("PrefxType ComboBox index=" &
DropListPreFxType.SelectedIndex.ToString & vbCrLf & "Text=" &
DropListPreFxType.Text & vbCrLf, MsgBoxStyle.Information, Me.Text & " -
@debug getPrefxType")
End If
getPrefxType = DropListPreFxType.Text.ToString()
End Try
getPrefxType = "Act" & getPrefxType
End Function
 
GS said:
why am i getting
A first chance exception of type 'System.NullReferenceException' occurred in
myapp.exe below? and what can i do get rid of it?

Does the application continue to run or does it crash and burn?
Does this only happen in the IDE?

If the answers to the above are "continue" and "yes", then you've
probably asked the IDE to trap this Exception when you don't necessarily
want it to.

Menu: Debug > Exceptions

System.NullReferenceException (wherever it appears in the /massive/ list
displayed) will be breaking into the debugger whenever it occurs - you
probably only care if it's not being handled in code.

HTH,
Phill W.
 
thank you looking at the problem.
The application continues to run and seems to give result as expected.

Only when run in debug mod of IDE , do I see the msg in the Immediate
windows.
When run from windows directly, I do not see any msg nor any registry entry
in application related to this
 
Back
Top