Windows Phone Developers

Wednesday, January 7, 2009

Warning: Variable 'XYZ' is used before it has been assigned a value. A null reference exception could result at runtime

Warning: Variable 'XYZ' is used before it has been assigned a value. A null reference exception could result at runtime

BC42104: Variable 'XYZ' is used before it has been assigned a value. A null reference exception could result at runtime

This error occurs when the variable is used before assigning a value. Most often it can be a part of some conditional statements

Dim sCurrentStage As String ' Holds the Current Process Name

Write2Log(sErrorText & " in " & sCurrentStage)

To avoid this warning assign a value in declaration

Dim sCurrentStage As String = "" ' Holds the Current Process Name

Digg Technorati Delicious StumbleUpon Reddit BlinkList Furl Mixx Facebook Google Bookmark Yahoo
ma.gnolia squidoo newsvine live netscape tailrank mister-wong blogmarks slashdot spurl StumbleUpon

No comments:

Post a Comment

kbAlertz.com :: Visual Studio 2005

kbAlertz.com :: Visual Studio 2008

kbAlertz.com :: Visual Basic 2005