|
-
Feb 16th, 2007, 04:28 PM
#1
Thread Starter
Hyperactive Member
[RESOLVED] Treeview selection
I have this code here, It will expand the treeview to the item but doesn't select it. I would like for it to select it just as if I clicked on it.
If anyone can help me with this I would sure appreciate it, Thank you.
VB Code:
Dim i As Integer
For i = 1 To frmmain.TreList.Nodes.Count
If frmmain.TreList.Nodes(i).Text = lstSearch.SelectedItem.Text Then
frmmain.TreList.Nodes(i).Selected = True
Exit For
End If
Next i
-
Feb 16th, 2007, 05:02 PM
#2
Re: Treeview selection
Set the Treeview.HideSelection property to False.
-
Feb 16th, 2007, 05:25 PM
#3
Thread Starter
Hyperactive Member
Re: Treeview selection
That didn't do it either brucevde, Still expands the treeview and doesn't select the treeview item that I selected from my listview.
Thank you for the help tho.
-
Feb 16th, 2007, 05:34 PM
#4
Re: Treeview selection
Try calling the treeview's click event procedure after selecting the node: Call TreList_Click
-
Feb 16th, 2007, 06:08 PM
#5
Re: Treeview selection
If HideSelection is True, the Treeview does not highlight the selected Node unless it has Focus. If HideSelection is False, the Treeview highlights the selected Node using a gray background if it does not have Focus and normal highlighting with Focus.
Highlighting is either on or off. If you are not seeing any highlighting when HideSelection = False, then there is a problem elsewhere in your code.
Last edited by brucevde; Feb 16th, 2007 at 06:14 PM.
-
Feb 16th, 2007, 06:15 PM
#6
Thread Starter
Hyperactive Member
Re: Treeview selection
Ok, yes it does that but what I mean is I would like for it to act as if I clicked on it and fill my textbox and so forth. Is there a way to do that or do I have to code it in a differrent way for it to do that.
-
Feb 16th, 2007, 06:29 PM
#7
Re: Treeview selection
Sorry. I misunderstood what you meant...
Which event do you want to fire? Treeview_NodeClick or Treeview_Click.
Regardless, you will have to call the event directly.
VB Code:
Dim i As Integer
For i = 1 To frmmain.TreList.Nodes.Count
If frmmain.TreList.Nodes(i).Text = lstSearch.SelectedItem.Text Then
frmmain.TreList.Nodes(i).Selected = True
frmMain.TreList_NodeClick frmmain.TreList.Nodes(i)
Exit For
End If
Next i
You will need to change the TreList_NodeClick procedure from Private to Public.
-
Feb 16th, 2007, 07:01 PM
#8
Thread Starter
Hyperactive Member
Re: Treeview selection
No problem, That happens.
Sorry. I misunderstood what you meant...
But, the good news is that it worked finally.
Thank you for the help.
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
|