Hi,
I am working in vb.net. i want to drag textbox value one form to another form without use show and hide property in the form.
any suggestion
thank 's
mukesh
2 Replies - 4280 Views - Last Post: 28 February 2011 - 07:15 AM
#1
Can i drag textbox value to one form to another form with vb.net
Posted 28 February 2011 - 05:07 AM
Replies To: Can i drag textbox value to one form to another form with vb.net
#2
Re: Can i drag textbox value to one form to another form with vb.net
Posted 28 February 2011 - 06:05 AM
Not sure exactly what you mean by dragging the value. But if you mean using the value from another form, then yes.
private sub() form1.textbox1.text = form2.textbox2.text end sub
#3
Re: Can i drag textbox value to one form to another form with vb.net
Posted 28 February 2011 - 07:15 AM
Code for form where text is dragged from.
Code for form to be dragged to.
Change AllowDrop porperty to TRUE for textbox.
Public Class frmtemp
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
Code for form to be dragged to.
Change AllowDrop porperty to TRUE for textbox.
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
End Class
This post has been edited by Shadar: 28 February 2011 - 07:17 AM
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote



|