I am doing this construct a lot of times and use it like:
This construct sometimes gives me an error and sometimes not.
If I have a few code lines after else, it will then always mark the first code line after 'else' saying 'Object reference not set to an instance of an object'.
If I delete that line, it will give the error on the next line after else .. and so on .. always the same error.
I am sure the construct is right, but it picks up an error from something else and always shows it on the same line of the construct.
What could be the cause of it?
PK
Code line:
If x=2 then
lblMessage.text = "It is an even number"
return
else
lblMessage.text = "x is not 2"
End if
This construct sometimes gives me an error and sometimes not.
If I have a few code lines after else, it will then always mark the first code line after 'else' saying 'Object reference not set to an instance of an object'.
If I delete that line, it will give the error on the next line after else .. and so on .. always the same error.
I am sure the construct is right, but it picks up an error from something else and always shows it on the same line of the construct.
What could be the cause of it?
PK