Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
225
drag and drop a row into another control (e.g. textbox)
posted

What I'm trying to do is allow users to drag and drop a row into, say, a textbox.  In doing so, I'd like to copy a hard-coded/predetermined cell's text into the textbox.  The example below shows me how to drag and drop a row into the same grid control to change the row position.  So, I tried to modify the sample project to see if it's feasible and I couldn't make it work and was wondering if it's at all possible.

http://devcenter.infragistics.com/Support/KnowledgeBaseArticle.aspx?ArticleID=10086

All I did was added a textbox to the sample project, set its allowdrop property to true. Then added the following event handlers for the textbox.  Am I doing something wrong or am I doing something that's simply not feasible?

  Private Sub TextBox1_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles TextBox1.DragDrop

    Dim SelRows As SelectedRowsCollection = TryCast(DirectCast(e.Data.GetData(GetType(SelectedRowsCollection)), SelectedRowsCollection), SelectedRowsCollection)

    TextBox1.Text = SelRows(0).Cells(1).Text

  End Sub

 

  Private Sub TextBox1_DragOver(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles TextBox1.DragOver

    e.Effect = DragDropEffects.Copy

  End Sub