Qbasicnews.com

Full Version: another vb problem
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
i have 2 forms in one program. i gather infomation with one and show it with the other. i cant seem to show it though. how would i do this?
Could you give us more information, but i might know what it is. When your using two different forms, you have to type things out differently. I'll use an example.

Code:
'Make Two forms called form1 and form2
'on form1, put a command button called command1 and a textbox called text1
'on form2, put a textbox called text1
'Then, put in the following code for command1 on the first form
Private Sub Command1_Click()
'This will take the text from text1 on form1 and put it
'in text1 on form2.
Form2.Text1.text = Form1.Text1.text
End Sub

If theres another problem, let me know.
yup, thats what i wanted. i thinki got it for now.
About what Mech said...
Both forms have to exist for that to work! If you've unloaded form1 by the time you get to form2, text1.text is already destroyed, i.e. inaccessable.
Yeah, I forgot to mention that. you can use the Form.Hide function to hide the first form. either that or use form1.visible = false. but the first method is easier.
Use:
Code:
Load Form1
or
Code:
Load Form2
If you don't know whether they're destroyed already.
If you reference a control on a form that is unloaded, that form will be loaded automagically.