Alright. I'm trying to make a 'game' in sense for the final project for the 9 weeks in my programming class. WE ARE ALLOWED TO USE OUTSIDE SOURCES.
Basically, I need to know how to make one form go to the next using a 'next' button, and I need it to keep everything entered into previous forms.
A back button would also help.
I've been googling and searching the hell out of this topic, and can't find much.
Page 1 of 1
Make a new form and 'next' button.
#2
Posted 23 October 2008 - 11:04 AM
Renamon, on Oct 23 2008, 04:29 PM, said:
Alright. I'm trying to make a 'game' in sense for the final project for the 9 weeks in my programming class. WE ARE ALLOWED TO USE OUTSIDE SOURCES.
Basically, I need to know how to make one form go to the next using a 'next' button, and I need it to keep everything entered into previous forms.
A back button would also help.
I've been googling and searching the hell out of this topic, and can't find much.
Basically, I need to know how to make one form go to the next using a 'next' button, and I need it to keep everything entered into previous forms.
A back button would also help.
I've been googling and searching the hell out of this topic, and can't find much.
Well I've assuming you are using VB6 or even .Net but I can't tell you the exact terminology for .Net.
Lets assume you have 6 Forms, Form1, Form2, Form3, Form4, Form5 and Form6. You have a Forward button on Form1. On Forms 2 to 5 you have a forward and back button and on 6 you just have a back button.
'Form1 Private Sub cmdForward_Click() Me.Hide Form2.Show End Sub
'Form2
Private Sub cmdForward_Click() Me.Hide Form3.Show End Sub Private Sub cmdBack_Click() Me.Hide Form1.Show End Sub
Form3
'Form3 Private Sub cmdForward_Click() Me.Hide Form4.Show End Sub Private Sub cmdBack_Click() Me.Hide Form2.Show End Sub
You can Hide the Forms temperarily or you can Unload them. When your app closes you need to Unload all Forms that you have in your project.
I'm not taking any credit of this forum but if you want specific questions about VB then there are loads of VB forums out there. I'm a member of 30 of them.
Keith
Martin2k
Windows ME (spare computer)
Windows XP 2002 Professional SP3 (desktop computer)
Windows Vista Home Premium SP2 (laptop computer)
Martin2k
Windows ME (spare computer)
Windows XP 2002 Professional SP3 (desktop computer)
Windows Vista Home Premium SP2 (laptop computer)
#3
Posted 24 October 2008 - 10:59 PM
New question. Howdo I make it so when I hit 'next' the name of th said character (Which is chosen by the palyer) appears in a label?
Label = X (The name is public as X) doesn't work.
Label = X (The name is public as X) doesn't work.
#4
Posted 28 October 2008 - 07:49 AM
Renamon, on Oct 25 2008, 03:59 AM, said:
New question. Howdo I make it so when I hit 'next' the name of th said character (Which is chosen by the palyer) appears in a label?
Label = X (The name is public as X) doesn't work.
Label = X (The name is public as X) doesn't work.
I'm not sure what you mean?
Where is this character from? It that the player name?
If you want to use a variable on all your Forms its easier to declare it As Public in a Module. You can declare it in a Form but you will have to keep referencing the Form to tretrieve the value.
In a Module
I would use a variable name thats suitable. This should happen in ALL Forms and Modules especially Control names. Don't use Label1, Text1, Command1 etc, give then a suitable name so you know what they do.
Public PlayerName As String don't use Name as this is a VB keyword.
Well you would have a TextBox (txtPlayerName) on your first Form that the player could enter their name. Before you switch to another Form you would use
If Trim$(txtPlayerName.Text) = vbNullString Then 'If no name is entered MsgBox "Please enter your name?" txtPlayerName.SetFocus Else PlayerName = txtPlayerName.Text End If
Then once you have a PlayerName you can use that in any Form
lblPlayerName.Caption = PlayerName
Again find a VB only forum read sig, you will find any help you want too.
Keith
Martin2k
Windows ME (spare computer)
Windows XP 2002 Professional SP3 (desktop computer)
Windows Vista Home Premium SP2 (laptop computer)
Martin2k
Windows ME (spare computer)
Windows XP 2002 Professional SP3 (desktop computer)
Windows Vista Home Premium SP2 (laptop computer)
Share this topic:
Page 1 of 1

Help


Back to top








