Results 1 to 3 of 3

Thread: auto add and fill dataset DGV Rows

Threaded View

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Feb 2013
    Location
    Newcastle, Australia
    Posts
    158

    auto add and fill dataset DGV Rows

    I have a panel that gets a files path using drag and drop and places the path into PathTextBox now this works with multiple files droped as once and the paths are stored as a strings.
    i.e
    Code:
        Private Sub Drag_n_Drop_Panel_DragDrop(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles Drag_n_Drop_Panel.DragDrop
    
            Dim theFiles() As String = CType(e.Data.GetData("FileDrop", True), String())
            For Each theFile As String In theFiles
              
            PathTextBox.Text = theFile
    
            Next
    
        End Sub
    
        Private Sub Drag_n_Drop_Panel_DragEnter(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles Drag_n_Drop_Panel.DragEnter
    
            If e.Data.GetDataPresent(DataFormats.FileDrop) Then
                e.Effect = DragDropEffects.Copy
            End If
    
        End Sub
    What i need to know is say if i drag and drop 10 files on the panel at the same time how i can get the path of each file to automatically be added to a new row for in cell 3 on the DGV

    I hope that makes sense.


    EDIT

    I tried this but doesnt seem to work


    with Imports System.IO

    Code:
    
        Private Sub Drag_n_Drop_Panel_DragDrop(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles Drag_n_Drop_Panel.DragDrop
    
            Dim theFiles() As String = CType(e.Data.GetData("FileDrop", True), String())
            For Each theFile As String In theFiles
    
                PathTextBox.Text = theFiles
    
                Me.Validate()
                Me.ProfilesBindingSource.EndEdit()
                Me.TableAdapterManager.UpdateAll(Me.Profiles_DatabaseDataSet)
    
            Next
    
        End Sub
    
        Private Sub Drag_n_Drop_Panel_DragEnter(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles Drag_n_Drop_Panel.DragEnter
    
            If e.Data.GetDataPresent(DataFormats.FileDrop) Then
                e.Effect = DragDropEffects.Copy
            End If
    
        End Sub
    Last edited by mason84; May 10th, 2013 at 11:03 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width