Link to home
Start Free TrialLog in
Avatar of tpiazza
tpiazza

asked on

find which treeview node is clicked

i have a trreview that i am trying to find the selected node and sometime the one above it

works fin wit hte following

TextBox1.Text = trvReaders.SelectedNode.Text & "  " & trvReaders.SelectedNode.Parent.Text

problem is when i click on the top node it locks up becuase there isnt a parent node


how do i get around this it 3 nodes deep
Avatar of Mike Tomlinson
Mike Tomlinson
Flag of United States of America image

Test for the existence of a Parent...

If Not IsNothing(trvReaders.SelectedNode.Parent) Then
    TextBox1.Text = trvReaders.SelectedNode.Text & "  " & trvReaders.SelectedNode.Parent.Text
Else
    TextBox1.Text = trvReaders.SelectedNode.Text
End If
Avatar of tpiazza
tpiazza

ASKER

thanks -- do you know how to make the rows in listview alternate color?
That's a completely different question...  =)

You can reduce this one to 20 points if you want.  Then ask another about the ListView.
Avatar of tpiazza

ASKER

raised it 20 -- do you know how to do it?  the entire listview goes one color or the other
ASKER CERTIFIED SOLUTION
Avatar of Mike Tomlinson
Mike Tomlinson
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial