|
-
May 15th, 2002, 10:52 AM
#1
Thread Starter
Registered User
what is going down here?
alright, this maybe be lengthy to explain, but i will give it a shot. i have a form, where the user can enter how many stations are needed, and in turn, then hits the next button, and a new form loads, and depending on how many stations the user entered previously, that is how many text boxes are enabled.
before, when the user hit the next button, i unloaded the form. but i also have back buttons. so recently, i discovered that, if you don't unload the form, and just do a form.hide, the data entered is still there. so when you hit the back button, i hide the second form.
the problem is, if the user enters more stations, the text boxes in the next form are all the same as the first input.
the code in the next button is the following
VB Code:
Headway = Text1
Stations = Text2
DailyBoardings = Text3
VolumeConstant = Text4
frmHeadway.Hide
DoEvents
Load frmTravelTimes
frmTravelTimes.Show vbModal
why doesn't it update the second form? i name stations = text2, and upon line load traveltimes has the following code
VB Code:
Private Sub Form_Load()
'Initialize TextBoxes and Labels
10 For s = 0 To 6
20 Text1(s).Enabled = False
30 Label1(s).Enabled = False
40 Next
50 For s = 0 To (Stations - 2)
60 Text1(s).Enabled = True
70 Label1(s).Enabled = True
80 Next
End Sub
does it skip over the load if it is already loaded? do u need to do an unload for it to update a form. i hope i explained this well enough. there maybe a simple answer.
thanks
jeff
-
May 15th, 2002, 10:56 AM
#2
Bouncy Member
i wouldnt unload the form either. you can simply call the Form_Load event again though, its just like another sub-routine...
-
May 15th, 2002, 11:11 AM
#3
Thread Starter
Registered User
doesn't load frmTravelTimes call the Form_load event...
also, in every form, there is a Form_load event, how do you call a form_load for a specific form?
I know this is probably a stupid question.
thanks,
jeff
-
May 15th, 2002, 11:13 AM
#4
Addicted Member
You could just move the initialize code to the Form_Activate() instead of Form_Load(). This way weather its your 1st, 2nd, 3rd.. time showing the form the code will always run as you are expecting.
-
May 16th, 2002, 03:26 AM
#5
Bouncy Member
Originally posted by jkw119
doesn't load frmTravelTimes call the Form_load event...
also, in every form, there is a Form_load event, how do you call a form_load for a specific form?
I know this is probably a stupid question.
thanks,
jeff
yes the Form_Load routine will fire each time the form is loaded, but you can also call it explicitly in code.
i.e.
VB Code:
Private Sub Command1_Click()
Form_Load
End Sub
This will not unload and reload the form etc, it will just execute the code in the Form_Load routine again
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
|