Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Testing for NULL objects
Message
From
21/03/2007 08:07:03
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
21/03/2007 06:04:28
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
01206415
Message ID:
01206445
Views:
13
>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
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform