How to check if my variable holds an instance of my class?
Dim myObject As Something
There I defined my variable myObject
of type Something
.
But, as you can see, I am giving it no value yet.
Sometime on runtime I want to check if myObject
is holding a value or not. I tried this:
If myObject <> Nothing Then
But apparently I开发者_如何转开发 can't do such comparison. Any ideas?
Like this:
If myObject IsNot Nothing
If myObject IsNot Nothing Then
Try this :
If Not IsNothing(myobject) Then 'DoSomething
精彩评论