|
-
Oct 15th, 2007, 03:50 PM
#1
Thread Starter
PowerPoster
[RESOLVED] [2005] Reorder items within a listbox via drag and drop
Does anyone have an example of how to do this in VB.NET? There are plenty of examples out there for VB6, but I have not yet been able to find this for .NET.
Last edited by BruceG; Oct 15th, 2007 at 08:15 PM.
Reason: resolved
"It's cold gin time again ..."
Check out my website here.
-
Oct 15th, 2007, 06:13 PM
#2
Re: [2005] Reorder items within a listbox via drag and drop
 Originally Posted by BruceG
Does anyone have an example of how to do this in VB.NET? There are plenty of examples out there for VB6, but I have not yet been able to find this for .NET.
Hi,
Here's a link how to do it in C#, perhaps you can change it to VB.Net.
http://psiman.wordpress.com/2006/12/...reablelistbox/
Wkr,
sparrow1
-
Oct 15th, 2007, 07:30 PM
#3
Thread Starter
PowerPoster
Re: [2005] Reorder items within a listbox via drag and drop
Thanks, I appreciate the link, but that's a custom control and uses WPF. It is a little heavier than what I was looking for ...
"It's cold gin time again ..."
Check out my website here.
-
Oct 15th, 2007, 07:30 PM
#4
Lively Member
Re: [2005] Reorder items within a listbox via drag and drop
Here is an example I put together real quick it should help you out.
Code:
Private Sub ListBox1_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles ListBox1.DragDrop
ListBox1.Items.Insert(ListBox1.IndexFromPoint(ListBox1.PointToClient(New Point(e.X, e.Y))), e.Data.GetData(DataFormats.Text))
ListBox1.Items.RemoveAt(ListBox1.SelectedIndex)
End Sub
Private Sub ListBox1_DragOver(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles ListBox1.DragOver
e.Effect = DragDropEffects.Move
End Sub
Private Sub ListBox1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles ListBox1.MouseDown
ListBox1.DoDragDrop(ListBox1.Text, DragDropEffects.All)
End Sub
-
Oct 15th, 2007, 08:14 PM
#5
Thread Starter
PowerPoster
Re: [2005] Reorder items within a listbox via drag and drop
BEAUTIFUL!!! Thank you very much.
"It's cold gin time again ..."
Check out my website here.
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
|