How to get what a variable is dimmed as? How to get what an object is declared as? If variable or object is Nothing?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



How to get what a variable is dimmed as? How to get what an object is
declared as? If variable or object is Nothing?

I want to do something like the following, but TypeOf and GetType
doesn't seem to work when a variable is Nothing. The watch window is
able to find the type, so why can't I with TypeOf or GetType()?

Public something as SomeClass

Public Sub SomeSub() as Boolean

If TypeOf something Is SomeOtherClass Then

' Do something here

End If

End Sub

? something.GetType() ' prints Referenced object has a value of
'Nothing'.
.