-
Forms and Textboxs
I have two forms in my project, Form1 and Form2
In Form1 there is one TextBox called Text1, and in the Form2 there is TextBox called Text2. I have one button in Form1, called Button1. When I click on Button1 I want that Form2 open and in Text2 is text from Text1.
Code for Button1:
Me.Hide
Form2.Show
Form2_Shown:
Text2.Text = Form1.Text1.Text
And Form2 open but in Text2 there is no text. What's the problem? :cry:
-
Re: Forms and Textboxs
Hi
Firstly can you check that the two textboxes are indeed named as you said in your post. I have run a trial using default textbox names with the code you gave for your button and the test ran OK.
If the textbox names are correct , try moving the following line of code into the form_load event.
Code:
Text2.Text = Form1.Text1.Text
-
Re: Forms and Textboxs
^Second that. Works for me in form load of form2.