0

Im an extreme newbie at VB and newbie to OO programming, and would like to make a basic text based RPG to start off (I made an RPG on my TI-84 calculator and would like to recreate it on VB)

I don't know how to do these things:

How do you load up a form when the player clicks something? Ex. Click "new game" button-> load up "NewGameForm".

Where do I Dim variables in order to make them "universal" . i.e. declare a variable and be able to call it in every single form.

Would really appreciate it :) All of this is making my head hurt :(

Edited by pasido: n/a

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by pasido
0

If you are actually using VB6.0 you could do any of the following...

this code creates multiple instances of the same form...

Dim F As New Form1
F.Show

This first loads a form and then shows it...

Load Form1
Form1.Show

this simply loads and shows a form

Form1.Show

To make a variable "global" add a module to your project and declare it publicly...

Scope: A variable declared in a procedure like Form_Load is only available within form load. A variable dimensioned in the general declarations section of the form (Dim/Private) can only be seen by those procedures within the form, however, declared as Public, other forms and modules can access its value if it is preceded by the forms name (Form.MyPublicStringVariable = "This is a test"). The same thing can be said for variables (Dim/Private/Public) declared in the general declarations section of a standard module, however, to access a publically declared variable from a module you do not need to prepend the module name...

Good Luck

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.