|
-
Aug 24th, 2000, 10:43 PM
#1
Thread Starter
New Member
Hi,
I am completely new to VB. My lecturer however has thrown a game assignment at me where I have to make a Digimon game.
One of the requirements is getting the user to enter their name. I have done this via a txtbox. If user does not enter their name and press the cmdStart button, a msgbox opens asking them to do so.
If they have entered atleast 1 character and press the button then the first form dissapears appears and you move onto a second form where the actual game is played.
However I need to display the entered name on subsequent forms automatically as they open up. I thought of displaying the name in a label. I think the first event of the second form will be:
Private Sub Form_Load()........however where do i go from there?
Thanks
Obie
-
Aug 24th, 2000, 11:16 PM
#2
Lively Member
Code:
Private Sub Form_Load()
Label1.Caption = Form1.Text1.Text
End Sub
-
Aug 26th, 2000, 08:15 AM
#3
Frenzied Member
You might want to assign the name to a global (public) variable if you're going to be using it in every form.
Harry.
"From one thing, know ten thousand things."
-
Aug 26th, 2000, 12:27 PM
#4
Frenzied Member
Since your totally new global variables go into Modules so open one up, and type it
Code:
Global Name 'name can be changed to anything
so now that can be used on any form.
-
Aug 26th, 2000, 01:59 PM
#5
Hyperactive Member
What else you could do is load up every form in the Form_Load() event in your first form. That way, it would be very easy to set the captions of the forms. Then, when you press ok or whatever, make it so that the text in the textbox = the caption of the form(s). You can do this like this:
Code:
Private sub Form_Load()
'load first form into memory
load form2
End sub
Private sub cmdOK_Click()
'set the textbox text as form captions.
txtbox1.text = form2.caption
end sub
Good luck on your game!
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
|