-
May 3rd, 2000, 03:37 PM
#1
Thread Starter
Conquistador
how can i drag a node, from a tree view control, into a textbox, and have it show the title of the node?
-
May 3rd, 2000, 04:53 PM
#2
Frenzied Member
In the treeview's MouseDown event;
Treeview1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button=1 Then Exit Sub
'only drag with right mouse button
Treeview1.SelectedItem = Treeview1.HitTest(X, Y)
Treeview1.DragIcon = Treeview1.SelectedItem.CreateDragImage
Treeview1.Drag 1
End Sub
Make sure the treeview's dragmode property is Manual.
You can get away without the TreeView1.DragIcon=.... line if you set a DragIcon in the treeview properties - otherwise it uses whatever icon is displayed on the treeview for that item.
In the text box's DragDrop event;
Private Sub txtView_DragDrop(Source As Control, X As Single, Y As Single)
If Source.Name = "Treeview1" Then
txtView.Text = Source.SelectedItem.Text
End If
End Sub
'Buzby'
Visual Basic Developer
"I'm moving to Theory. Everything works there."
-
May 4th, 2000, 07:30 PM
#3
Thread Starter
Conquistador
thankyou very much, but what does "Hittest" do ?
-
May 11th, 2000, 04:51 PM
#4
Frenzied Member
.HitTest is a method of the treeview that determines which item the mouse is over based on the X and Y co-ordinates. You need it to determine which item you're dragging..
'Buzby'
Visual Basic Developer
"I'm moving to Theory. Everything works there."
-
May 13th, 2000, 02:08 PM
#5
Thread Starter
Conquistador
thank you veryt much
-
Oct 13th, 2004, 12:00 AM
#6
New Member
Can anyone tell me how to do this with VB.Net.
-
Oct 13th, 2004, 01:31 AM
#7
probably, if you ask in the Net forum
Add the checkmark, and the word [RESOLVED] to your first post in this thread if it is resolved.
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
|