>How can I test if an object is NULL?
>
>I am trying to build the hierarchy of an object ;
>
>
>Function GetHierarchy(ByVal toObject As Object)
>Dim lcHierarchy As String
>Dim loObject As Object
>loObject = toObject
>lcHierarchy = loObject.Name
>
>Do
> If VarType(loObject.Parent) = Nothing Then
> Exit Do
> Else
> loObject = loObject.Parent
> lcHierarchy = loObject.Name & "." & lcHierarchy
> End If
>Loop
>Return lcHierarchy
>End Function
>
>
>The problem is that VarType(loObject.Parent) returns Object{9} even if .parent is a null value and loObject.Parent = Nothing generates an error if loObject.parent is not Null
>
>In VFP I would have used ISNULL() but I know there is no direct equivelant in VB.NET so how can I check for loObject.Parent being null?
>
>Regards
>
>
>
>Gary Williams.
Gary,
It should be:
if loObject.Parent = Nothing
Cetin