List Box Drag and Drop Error

Hello,
I thought I had this done but I keep getting a error on my mouse down event.  Here is the Code I have.

This is how I am populated my First list box
 Private Sub cboFiles_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboFiles.SelectedIndexChanged
        Try
            Dim mySelDir As New DirectoryInfo(cboFiles.SelectedItem)
            Dim myFilename As FileInfo
            Dim myImageDir(1) As DirectoryInfo
            Dim myText As String

            myImageDir = mySelDir.GetDirectories("Images")

            lstDgnFiles.Items.Clear()
            lblOutPutDir.Text = myImageDir(0).FullName.ToString

            For Each myFilename In mySelDir.GetFiles("*.dgn")
                lstDgnFiles.Items.Add(myFilename)  'Add tostring to get out of the filename
            Next myFilename
        Catch ex As Exception
            MessageBox.Show("The process failed: {0}", ex.ToString())

        End Try

This is my code when I double click a file.  This works fine
  Private Sub lstDgnFiles_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles lstDgnFiles.DoubleClick

        lstMakePDF.Items.Add(lstDgnFiles.SelectedItem)

    End Sub


this Code i got from iboutchkine



 Private Sub lstDgnFiles_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles lstDgnFiles.MouseDown

        lstDgnFiles.DoDragDrop(lstDgnFiles.Items(lstDgnFiles.SelectedIndex.ToString()), DragDropEffects.Copy)

    End Sub

    Private Sub lstMakePDF_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles lstMakePDF.DragEnter
        If e.Data().GetDataPresent(DataFormats.Text) Then
            e.Effect() = DragDropEffects.Move
        Else
            e.Effect() = DragDropEffects.None
        End If
    End Sub

    Private Sub lstMakePDF_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles lstMakePDF.DragDrop
        lstMakePDF.SelectedItem = e.Data().GetData(DataFormats.Text).ToString()
    End Sub
End Class
sherrick123Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

LacutahCommented:
    lstDgnFiles.DoDragDrop(lstDgnFiles.Items(lstDgnFiles.SelectedIndex.ToString()), DragDropEffects.Copy)

Items is an array, access by integer index, so lstDgnFiles.SelectedIndex.ToString would not work because it's a String...

Try:
     lstDgnFiles.DoDragDrop(lstDgnFiles.Items(lstDgnFiles.SelectedIndex), DragDropEffects.Copy)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
sherrick123Author Commented:
It still gives me a out of Range error????
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.