List view, folder and subitem destination with drag and drop
If you need help with a project or need to know how to do something specific in VB.NET then please ask your questions in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
3 posts
Page 1 of 1
Hello i have a listview, i want to make so when i drag a folder it adds the folders name in listviews first column which is folder name, and then it adds the full path to the first subitem destination, i know how to drag and drop but not how i can do this
Last edited by AnoPem on Sun Apr 15, 2012 6:00 pm, edited 1 time in total.
You could use this:
Code: Select all
Private Sub ListView1_DragDrop(sender As System.Object, e As System.Windows.Forms.DragEventArgs) Handles ListView1.DragDrop
Dim paths As String() = e.Data.GetData(DataFormats.FileDrop)
For i As Integer = 0 To paths.Length - 1
Dim foldername As String = Path.GetFileName(paths(i))
ListView1.Items.Add(New ListViewItem(New String() {foldername, paths(i)}))
Next
End Sub
mandai wrote:You could use this:Thank you work as it should cooll;Code: Select allPrivate Sub ListView1_DragDrop(sender As System.Object, e As System.Windows.Forms.DragEventArgs) Handles ListView1.DragDrop Dim paths As String() = e.Data.GetData(DataFormats.FileDrop) For i As Integer = 0 To paths.Length - 1 Dim foldername As String = Path.GetFileName(paths(i)) ListView1.Items.Add(New ListViewItem(New String() {foldername, paths(i)})) Next End Sub
3 posts
Page 1 of 1
Copyright Information
Copyright © Codenstuff.com 2020 - 2023