Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Manipulate controls in another forms

Status
Not open for further replies.

marcseys

Programmer
Dec 6, 1999
23
0
0
GB
Hi,

I want to manipulate the content of a textbox in the first form with data of a second form.

To start I wrote

...
' F1
Dim F2 as new frm_form2
F2.textbox1.text = me.textbox1.text
F2.show


' So I change the text in the second form and press a button, which should return the data. But how do you do this?
 
Use methods in Form 2. Do not do direct manipulation.
'''Form1
Dim F2 as new frm_form2
Dim F2Text As String
F2Text = F2.GetText(me.textbox1.text)


'''Form 2
Private m_Text As String = String.Empty
Public Function GetText(txt as String) as STring
textbox1.Text = txt
me.hide
me.ShowDialog
Return m_Text
End Function

Private Sub btn_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles btn.Click
m_Text = TextBox1.Text
me.hide ' Allow execute after ShowDialog
End Sub

Compare Code
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top