sherrick123
asked on
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_SelectedIndexChan ged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboFiles.SelectedIndexChan ged
Try
Dim mySelDir As New DirectoryInfo(cboFiles.Sel ectedItem)
Dim myFilename As FileInfo
Dim myImageDir(1) As DirectoryInfo
Dim myText As String
myImageDir = mySelDir.GetDirectories("I mages")
lstDgnFiles.Items.Clear()
lblOutPutDir.Text = myImageDir(0).FullName.ToS tring
For Each myFilename In mySelDir.GetFiles("*.dgn")
lstDgnFiles.Items.Add(myFi lename) '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(By Val sender As Object, ByVal e As System.EventArgs) Handles lstDgnFiles.DoubleClick
lstMakePDF.Items.Add(lstDg nFiles.Sel ectedItem)
End Sub
this Code i got from iboutchkine
Private Sub lstDgnFiles_MouseDown(ByVa l sender As Object, ByVal e As System.Windows.Forms.Mouse EventArgs) Handles lstDgnFiles.MouseDown
lstDgnFiles.DoDragDrop(lst DgnFiles.I tems(lstDg nFiles.Sel ectedIndex .ToString( )), DragDropEffects.Copy)
End Sub
Private Sub lstMakePDF_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragE ventArgs) Handles lstMakePDF.DragEnter
If e.Data().GetDataPresent(Da taFormats. 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.DragE ventArgs) Handles lstMakePDF.DragDrop
lstMakePDF.SelectedItem = e.Data().GetData(DataForma ts.Text).T oString()
End Sub
End Class
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_SelectedIndexChan
Try
Dim mySelDir As New DirectoryInfo(cboFiles.Sel
Dim myFilename As FileInfo
Dim myImageDir(1) As DirectoryInfo
Dim myText As String
myImageDir = mySelDir.GetDirectories("I
lstDgnFiles.Items.Clear()
lblOutPutDir.Text = myImageDir(0).FullName.ToS
For Each myFilename In mySelDir.GetFiles("*.dgn")
lstDgnFiles.Items.Add(myFi
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(By
lstMakePDF.Items.Add(lstDg
End Sub
this Code i got from iboutchkine
Private Sub lstDgnFiles_MouseDown(ByVa
lstDgnFiles.DoDragDrop(lst
End Sub
Private Sub lstMakePDF_DragEnter(ByVal
If e.Data().GetDataPresent(Da
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.DragE
lstMakePDF.SelectedItem = e.Data().GetData(DataForma
End Sub
End Class
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER