I can make the compiler give me an error (Use of variable prior to assignment) with:
private sub Test()
Dim ord As Order
Dim ord2 As Order
ord2 = ord
end sub
but not with:
Friend Class frmReceiving
...
Private mobjOrder As Order
...
private sub Testing()
Dim ord2 As Order
ord2 = mobjOrder
end sub
How can I make it flag as error?
Your second example is not an error. mobjOrder
will be initialized to Nothing
. You then assign Nothing
to ord2
. That's a perfectly legitimate thing to do.