开发者

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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜