Computer Science Canada sending info from one form to the other |
Author: | cool dude [ Mon Dec 26, 2005 11:09 am ] |
Post subject: | sending info from one form to the other |
hi how do u send information from one form to the other form? for instance if i chose one of the options in the combo box how would i know which option i chose in the other form? |
Author: | cool dude [ Mon Dec 26, 2005 1:05 pm ] | ||
Post subject: | |||
***Edit*** does anybody know wats wrong with this code. i made a combo box with the choices easy, medium, hard, and insane. i want to figure out which one was chosen and then i want to send it to my main program where the chosen speed will occur.
The error that i get is subscript out of range in the main program |
Author: | HazySmoke)345 [ Mon Dec 26, 2005 2:51 pm ] | ||||||||
Post subject: | |||||||||
Well, When I ran the program, the program didn't run through the script at all. I don't really know why that happens. But I think I know what's wrong. First, maybe you shouldn't have created an array for speed. Speed can be either 0,1,2 or 3, so I would change it to something like this:
Secondly:
![]() Thirdly:
|
Author: | HazySmoke)345 [ Mon Dec 26, 2005 2:57 pm ] | ||
Post subject: | |||
Oh, and, if you want to send information inter-Form-ly. This is what you do. Let's say that you created Text1, cmd in Form1 and Text2 in Form2. And you want to send whatever is written in Text1 to Text2 by the click of the button. This is what you write
|
Author: | cool dude [ Mon Dec 26, 2005 3:32 pm ] | ||||||||
Post subject: | |||||||||
HazySmoke)345 wrote: Secondly:
![]() No u don't have to place the brackets on the 1 i didn't even notice that i did that. ![]() Quote: Thirdly:
yes it should be around srry for that stupid mistake Now back to the main problem. watever speed the user chooses in the combo box that speed must effect the main program. which means if they chose easy than my main program should know that and adjust the timer intervals smaller or greater to make it go faster or slower. now i don't know how to pass the variable speed that they choose in the combo box to my main program. the example u gave me
this is only good if u want the information from one textbox to the other i dunno how to do the same thing with the speed. can u please explain how i would go about doing this? |
Author: | cool dude [ Mon Dec 26, 2005 4:34 pm ] |
Post subject: | |
okay i fixed it all up and all i need to know is when the user clicks on the command button "play" how can i send the speed from the settings form to the main game. at the moment, because i'm not sending the speed the user chose, it sets the speeds value to 0. (default). |
Author: | HazySmoke)345 [ Mon Dec 26, 2005 4:35 pm ] | ||
Post subject: | |||
If you want to use a same variable in two forms. You can create a module and write this in it:
|
Author: | cool dude [ Mon Dec 26, 2005 5:12 pm ] |
Post subject: | |
oh my god i completely forgot to declare speed as a module. thanks a lot!!! finally i got it working. ![]() |