Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Private ReportLog As StringBuilder

Private Sub DoThat()

   'We didn't assign any value to the ReportLog so here we want to check if it's empty or not?
   If ReportLog IsNot Nothing And ReportLog.Length > 0 Then
       '
   End IF

End Sub

The problem is that "If ReportLog IsNot Nothing And ReportLog.Length > 0 Then" itself throws an exception!

 

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

A first chance exception of type 'System.ComponentModel.Win32Exception' occurred in System.dll

 

How should I check that variable?

Thank you :)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...