Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

Make a new form and 'next' button.


  • Please log in to reply
3 replies to this topic

#1 Renamon

Renamon

  • Members
  • 56 posts
  • OFFLINE
  •  
  • Local time:11:07 PM

Posted 23 October 2008 - 10:29 AM

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.

BC AdBot (Login to Remove)

 


#2 Keithuk

Keithuk

  • Members
  • 957 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:04:07 AM

Posted 23 October 2008 - 11:04 AM

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.


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. :flowers:

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. :thumbsup:

Keith

Windows ME (spare computer)
Windows XP 2002 Professional SP3 (desktop computer)
Windows 7 Professional SP1 32bit (laptop computer)

Windows 8 64bit spare drive for laptop computer


#3 Renamon

Renamon
  • Topic Starter

  • Members
  • 56 posts
  • OFFLINE
  •  
  • Local time:11:07 PM

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.

#4 Keithuk

Keithuk

  • Members
  • 957 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:04:07 AM

Posted 28 October 2008 - 07:49 AM

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.


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. :thumbsup:

Keith

Windows ME (spare computer)
Windows XP 2002 Professional SP3 (desktop computer)
Windows 7 Professional SP1 32bit (laptop computer)

Windows 8 64bit spare drive for laptop computer





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users