|
-
Dec 27th, 2001, 10:24 PM
#1
Thread Starter
Member
Problems with a variable
I have a form(form1) and I have to call another form(form2) to do some proces. In the form2 i have to look for a information from the client that have in form1.
form2.text1.text = form1.text1.text
and some times the information than the form1 give me is like that past client example:
form1.text 1 = 1
call form2
form2.text1.text = form1.text1.text
form2.text1.text shoul be 1
I out from form2 and change text1 from form1
form1.text1.text = 5
call for2
form2.text1.text = form1.text1.text
the result should be 5 but in some ocasions is the last number in this case 1.
Why?.
Thanks for advance
Sorry for my english.
-
Dec 27th, 2001, 11:10 PM
#2
Addicted Member
Hi arazcon,
Don't know how you call Form2 from Form1.
But could you try to use Load, Unload and Show:
Load Form2
Form2.Show
Hope it helps
Keiko
-
Dec 28th, 2001, 02:10 AM
#3
Hyperactive Member
Can show your source code?
Did you put this under Command button's Click event?
Code:
Form2.Text1.Text = Form1.Text1.Text
Wanna try this in Form1.Text1_Change event?
Code:
Form2.Text1.Text = Form1.Text1.Text
or
Form2.Text1.Text = Text1.Text 'Since it's local
-
Dec 28th, 2001, 02:58 AM
#4
Addicted Member
the different between Form1.Show and Load Form1 is that
Form1.Show will only show the form. It may not update the
value. But if you Load a form, it will update the values of all objects.
If you mentioned a command button, then
Load Form2
Form2.Text1.Text = Form1.Text1.Text
Form2.Show
Hope it helps
Keiko
-
Dec 28th, 2001, 01:09 PM
#5
Thread Starter
Member
Thanks everybody
Hi everybody. This is a very simple sample that show you what i want and wath is my problem. some times the form2 show the past information from form1.
thanks for advance again.
-
Dec 28th, 2001, 05:00 PM
#6
Hyperactive Member
Try to put the code in Form2 in this way
Code:
Private Sub Form_Activate()
Text1.Text = Form1.Text1.Text
Text2.Text = Form1.Text2.Text
End Sub
-
Dec 28th, 2001, 07:01 PM
#7
Thread Starter
Member
Thanks again
Thanks HardDisk. My questions are :
1. What is the diference between Form_Load and Form_Activate
2. What is better
Thanks
-
Dec 28th, 2001, 07:41 PM
#8
Thread Starter
Member
Thanks again
Thanks HardDisk. My questions are :
1. What is the diference between Form_Load and Form_Activate
2. What is better
Thanks
-
Dec 28th, 2001, 08:21 PM
#9
Hyperactive Member
Re: Thanks again
Originally posted by arazcon
Thanks HardDisk. My questions are :
1. What is the diference between Form_Load and Form_Activate
2. What is better
Thanks
You are welcome!
I'll reply based on my own experienced.
1) Form_Load will be triggered when you do a Load Form/Form.Show or access to it's objects, such as textboxes and stuff. To trigger Form_Load again, you need to terminate the form, which will trigger the Form_Terminate event. Form_Activate will be triggered when the form GotFocus/goes on top. This can be seen when you made some changes to your form1 textboxes, and then click on Form2, the update will be made without clicking on the command button.
2) Both has its usage. For commands needed to be run once, put them into Form_Load. Form_Activate is useful when you want to Refresh your recordset queries, after making some changes to the DB, and to get the updated records when clicking on the particular Form.
Hope these help.
-
Dec 29th, 2001, 03:38 PM
#10
Thread Starter
Member
Thanks very much
Thanks very much again and happy new year.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|