I created a new vb windows application and dragged 2 textboxes onto Form1.
Then I coppied the code below from MSDN article
(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vstechart/html/vbtchimpdragdrop.asp).
The code for TextBox1 executes OK, but fails to execute for TextBox2 . Can
anyone shed some light on this for me?

Thanks.

Private MouseIsDown As Boolean = False

Private Sub TextBox1_MouseDown(ByVal sender As Object, ByVal e As _
System.Windows.Forms.MouseEventArgs) Handles TextBox1.MouseDown
' Set a flag to show that the mouse is down.
MouseIsDown = True
End Sub

Private Sub TextBox1_MouseMove(ByVal sender As Object, ByVal e As _
System.Windows.Forms.MouseEventArgs) Handles TextBox1.MouseMove
If MouseIsDown Then
' Initiate dragging.
TextBox1.DoDragDrop(TextBox1.Text, DragDropEffects.Copy)
End If
MouseIsDown = False
End Sub

Private Sub TextBox2_DragEnter(ByVal sender As Object, ByVal e As _
System.Windows.Forms.DragEventArgs) Handles TextBox2.DragEnter
' Check the format of the data being dropped.
If (e.Data.GetDataPresent(DataFormats.Text)) Then
' Display the copy cursor.
e.Effect = DragDropEffects.Copy
Else
' Display the no-drop cursor.
e.Effect = DragDropEffects.None
End If
End Sub

Private Sub TextBox2_DragDrop(ByVal sender As Object, ByVal e As _
System.Windows.Forms.DragEventArgs) Handles TextBox2.DragDrop
' Paste the text.
TextBox2.Text = e.Data.GetData(DataFormats.Text)
End Sub

--
moondaddy@nospam.com

Re: Problem with DragDrop between 2 textboxes by moondaddy

moondaddy
Sat Nov 06 22:03:01 CST 2004

I figured it out. I failed to set the "Allow Drop" property in the target
control. Well y'all know my level of experience in DragDrop now.

--
moondaddy@nospam.com
"moondaddy" <moondaddy@nospam.com> wrote in message
news:Oq3wetHxEHA.2788@TK2MSFTNGP15.phx.gbl...
>I created a new vb windows application and dragged 2 textboxes onto Form1.
>Then I coppied the code below from MSDN article
>(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vstechart/html/vbtchimpdragdrop.asp).
>The code for TextBox1 executes OK, but fails to execute for TextBox2 . Can
>anyone shed some light on this for me?
>
> Thanks.
>
> Private MouseIsDown As Boolean = False
>
> Private Sub TextBox1_MouseDown(ByVal sender As Object, ByVal e As _
> System.Windows.Forms.MouseEventArgs) Handles TextBox1.MouseDown
> ' Set a flag to show that the mouse is down.
> MouseIsDown = True
> End Sub
>
> Private Sub TextBox1_MouseMove(ByVal sender As Object, ByVal e As _
> System.Windows.Forms.MouseEventArgs) Handles TextBox1.MouseMove
> If MouseIsDown Then
> ' Initiate dragging.
> TextBox1.DoDragDrop(TextBox1.Text, DragDropEffects.Copy)
> End If
> MouseIsDown = False
> End Sub
>
> Private Sub TextBox2_DragEnter(ByVal sender As Object, ByVal e As _
> System.Windows.Forms.DragEventArgs) Handles TextBox2.DragEnter
> ' Check the format of the data being dropped.
> If (e.Data.GetDataPresent(DataFormats.Text)) Then
> ' Display the copy cursor.
> e.Effect = DragDropEffects.Copy
> Else
> ' Display the no-drop cursor.
> e.Effect = DragDropEffects.None
> End If
> End Sub
>
> Private Sub TextBox2_DragDrop(ByVal sender As Object, ByVal e As _
> System.Windows.Forms.DragEventArgs) Handles TextBox2.DragDrop
> ' Paste the text.
> TextBox2.Text = e.Data.GetData(DataFormats.Text)
> End Sub
>
> --
> moondaddy@nospam.com
>



Re: Problem with DragDrop between 2 textboxes by Jeff

Jeff
Sun Nov 07 03:21:51 CST 2004

On 07/11/2004 moondaddy wrote:

> I figured it out. I failed to set the "Allow Drop" property in the
> target control. Well y'all know my level of experience in DragDrop
> now.

Yes, higher then it was before, that's how we all learn :-)

Anyway, you're not the only person to have done, just honest enough to
admit it!

--
Jeff Gaines Damerham Hampshire UK
Posted with XanaNews 1.16.4.6