Link to home
Start Free TrialLog in
Avatar of Murray Brown
Murray BrownFlag for United Kingdom of Great Britain and Northern Ireland

asked on

VB.net Drag and drop not working on a TaskPane

Hi

I have a TaskPane in my VB.net app where I had drag and drop working
on a RichTextBox. I then tried to cancel this and do the same on a ListBox but nothing works
even though I have set Allow Drop to true.
Avatar of John (Yiannis) Toutountzoglou
John (Yiannis) Toutountzoglou
Flag of Greece image

Hi ...Can you show some Code?
Avatar of Murray Brown

ASKER

Here's the code where it works. If I try to do the same with a ListBox it doesn't


 Private Sub txtWhereColumnVariables_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles txtWhereColumnVariables.DragDrop
        Try
 
            Dim oDroppedText As String
            If e.Data.GetDataPresent(System.Windows.Forms.DataFormats.StringFormat) Then
                oDroppedText = e.Data.GetData(System.Windows.Forms.DataFormats.StringFormat).ToString()
                Me.txtWhereColumnVariables.Text = oDroppedText

                If Globals.ThisAddIn.oRIGHT.lblDataBaseType.Text = "Access" Then
                    If Mid(oDroppedText, 1, 1) = "[" Then
                        Dim arrSplit As Object = Split(oDroppedText, ".")
                        Dim oTableName As String = Mid(arrSplit(0), 2, Len(arrSplit(0)) - 2)
                        Dim oColumnName As String = Mid(arrSplit(1), 2, Len(arrSplit(1)) - 2)
                        Dim oResult As String = oGet_Access_Data_Type_Look(oTableName, oColumnName)
                        Me.txtWhereColumnVariables.Text = Me.txtWhereColumnVariables.Text & " " & oResult
                        Call oLoadListBox(oTableName, oColumnName)
                    End If
                Else
                    If Mid(oDroppedText, 1, 1) = "[" Then
                        Dim arrSplit As Object = Split(oDroppedText, ".")
                        Dim oTableName As String = Mid(arrSplit(0), 2, Len(arrSplit(0)) - 2)
                        Dim oColumnName As String = Mid(arrSplit(1), 2, Len(arrSplit(1)) - 2)
                        Dim oResult As String = Get_SQL_Data_Type_Look(oTableName, oColumnName)
                        Me.txtWhereColumnVariables.Text = Me.txtWhereColumnVariables.Text & " " & oResult
                        Call oLoadListBox(oTableName, oColumnName)
                    End If
                End If
            End If
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
    End Sub
SOLUTION
Avatar of John (Yiannis) Toutountzoglou
John (Yiannis) Toutountzoglou
Flag of Greece image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks.
ASKER CERTIFIED SOLUTION
Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks for the help