if the energy is 100 and then you defeat a enemy then you get more energy but how do i get the new energy in an other form.
Printable View
if the energy is 100 and then you defeat a enemy then you get more energy but how do i get the new energy in an other form.
Say your original energy is the value in lable1 on form1. After defeating the enemy, your form1.visible = false, and form2.visible = true. On form2 you have another label1 for the new energy level. Here is how I would do it:
'new energy label
'x = the desired increasing amount
label1.caption = val(form1.label1 + x)
Well, this will work but it's a very stupid way.
Add a module where you can declare global vars so you can use them on each form.
-
'In module
Global A as Long
'In any form
A = 10
'In another form
Caption = A
-
Go to a module and say:
Global energy as integer
then your variable will work in every form.
Easy as pie
Private Sub Form2_Load()
lblENG.Caption = Form1.lblENG.Caption
End Sub