Mit Drag&Drop eine datei an eine bestimmte stelle kopieren

  • VB.NET

    Mit Drag&Drop eine datei an eine bestimmte stelle kopieren

    Hi,

    mein code sieht wie folgt aus

    VB.NET-Quellcode

    1. Private Sub ListBox3_DragEnter(ByVal sender As Object, ByVal e As _
    2. System.Windows.Forms.DragEventArgs) Handles ListBox3.DragEnter
    3. If e.Data.GetDataPresent(DataFormats.FileDrop) Then
    4. e.Effect = DragDropEffects.All
    5. End If
    6. End Sub
    7. Private Sub ListBox3_DragDrop(ByVal sender As Object, ByVal e As _
    8. System.Windows.Forms.DragEventArgs) Handles ListBox3.DragDrop
    9. If e.Data.GetDataPresent(DataFormats.FileDrop) Then
    10. Dim MyFiles() As String
    11. Dim i As Integer
    12. ' Assign the files to an array.
    13. MyFiles = e.Data.GetData(DataFormats.FileDrop)
    14. ' Loop through the array and add the files to the list.
    15. For i = 0 To MyFiles.Length - 1
    16. ListBox3.Items.Add(MyFiles(i))
    17. 'lesen der zeit
    18. Next
    19. End If
    20. End Sub


    jetzt ist es so das, wenn ich eine datei in die liste kopiere diese datei immer an das Ende gehängt wird.
    Gibt es eine Möglichkeit wenn in der liste schon 2 Einträge sind
    z.B

    hallo.txt
    test.txt

    eine dritte datei "juhuu.txt" zwischen hallo.txt und test.txt per drag&Drop zu kopieren

    danke für die Hilfe


    Edit by LaMa5: VB-Tag eingefügt

    Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von „LaMa5“ ()