Click to See Complete Forum and Search --> : TreeView question


nordyj
November 16th, 1999, 05:41 PM
I'm stuck using VB at work, and I'm hoping that I can get some help on something here. I'm using the TreeView controls HitTest method. According to MSDN, this will return 'Nothing' if the XY coordinates do not match up to a tree item. Yet, I can't find a way to compare my node object to 'Nothing'. I always get run time errors. Any body know enough about the Tree Control in VB to help?

czimmerman
November 16th, 1999, 06:32 PM
To compare any object variable to nothing you use the following:

if obj is nothing then ..

So the correct syntax using the HitTest method should be:

if TreeView1.HitTest(x,y) is Nothing Then
'DO whatever
end if

Charlie Zimmerman
http://www.freevbcode.com