|
-
Sep 19th, 2003, 09:04 PM
#1
TreeView Question
If a user selects something, how can I get the text of what is selected?
Like say I have this:
Code:
My Program|
|Hello World
|Never!
If the user selects "Never!", how can I just get the text "Never!"? I am NOT interested in the node number, jsut the text and the order may be different all the time.
-
Sep 20th, 2003, 04:57 PM
#2
Sleep mode
I don't know if this is what you mean :
VB Code:
MessageBox.Show(TreeView1.Nodes.Item(TreeView1.SelectedNode.Index).Text)
-
Sep 20th, 2003, 05:02 PM
#3
Sleep mode
Put that code in this event : TreeView1_AfterSelect or if you put it in a Button , then you must make sure that an item is selected .
-
Sep 20th, 2003, 06:05 PM
#4
Originally posted by Pirate
I don't know if this is what you mean :
VB Code:
MessageBox.Show(TreeView1.Nodes.Item(TreeView1.SelectedNode.Index).Text)
Does not work correctly
I am putting it into a string so I can use it, however, when I highlight an item and use a button on a context menu, it will copy the 3rd root node into the string and not the selected item. If I try to click the button again, it closes and said it operated out of the range or something....
-
Sep 21st, 2003, 12:54 AM
#5
MessageBox.Show(TreeView1.SelectedNode.Text)
-
Sep 21st, 2003, 01:09 AM
#6
Originally posted by Edneeis
MessageBox.Show(TreeView1.SelectedNode.Text)
thanks 
though I don't know why I didn't use that in the first place.... =/
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|