English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Say i have two forms in visual basic. both has a textbox. How can i make it so that if someone types something in it and click on a button in form2, it add that specified text to form1 textbox?

2007-10-05 14:43:37 · 2 answers · asked by Anonymous in Computers & Internet Programming & Design

2 answers

hi assume the name of the textboxes are : textbox name in form2 is txt1 and textbox name in form1 i txt2

you write the following code in the button click event of form2

form1.txt2.text = txt1.text

2007-10-05 14:53:48 · answer #1 · answered by podal s 2 · 0 0

Write a public subroutine or function in each form which takes a string variable and displays it in the text box. Then call that public function from the other forms command button click event

In form1 create the following sub
Public Sub LoadTextBox( myStr as string)
textbox1.text = myStr)
End Sub

In form2

Private sub button1_click
form1.LoadTextBox(me.textbox1.text) 'me referrs to form2
end sub

2007-10-05 23:07:05 · answer #2 · answered by MarkG 7 · 0 0

fedest.com, questions and answers