Shoutbox

VB game - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Skype & Technology (/forumdisplay.php?fid=9)
+---- Forum: Tech Talk (/forumdisplay.php?fid=17)
+----- Thread: VB game (/showthread.php?tid=77085)

VB game by Th3rmal on 08-29-2007 at 09:06 AM

im making a game for preschoolers (a simple adding game) and what i wanna do is at the end make an accuracy score (eg. your accuracy for the right answer was 80%). what ive got is 8 forms, one for each question (please dont say "why didnt you use the one form" the answer is i tried that, i coulnt get it to work properly so my teacher told me to do it on different forms) anyway, is there a way to add up the numbers in a label in each form ( eg. form 1 label = 2, form 2 label = 1, therefore Form1 label plus form 2 label = 3)

the only reason i am stuck is that i cant seem to use other forms information when a different form is loaded up, i want to know if you can somehow in the background add these numbers together, or even better when you go to the next form it adds the number from the last form into the new form..

i hope u guys get what i mean and can help me

thx in advance


RE: VB game by Jarrod on 08-29-2007 at 10:10 AM

not quite
do they need to click a button for it to happen or is it ment to be dynamic?


RE: VB game by Mike on 08-29-2007 at 10:22 AM

Add a module and inside it type:

code:
Public LabelTotal as Integer
Then, when you want to add to it (usually after you change your label's caption), just use:
code:
LabelTotal = LabelTotal + CInt(LabelNameGoesHere.Caption)
When you want to see what in LabelTotal, just use:
code:
lblTotal.Caption = LabelTotal
(where lblTotal is the name of the label where you want do display the result).

Good luck :)

Btw, what was your problem with doing it in one form?
RE: VB game by Th3rmal on 08-29-2007 at 12:50 PM

m y problem with doing it in one form was even when i pressed the right answer it would say try again because VB thought i had kinda pressed the button twice.

to xen0h: after pressing each button 1 is added to the total


RE: VB game by Jarrod on 08-30-2007 at 05:56 AM

ah got ya good luck


RE: VB game by Th3rmal on 08-30-2007 at 07:20 AM

lol now that u got wat i mean can u help me any further,?


RE: VB game by Jarrod on 08-30-2007 at 07:35 AM

what part you need help with?


RE: VB game by rav0 on 08-30-2007 at 08:26 AM

You can access stuff from other forms.

Say you wanted to access the text inside a textbox called Text1 and this textbox is on the form called Form1. You reference it like "Form1.Text1.Text" (whereas if it was not on a different form you could just use "Text1.Text" to get stuff from a different form just use the form name followed by a dot at the beginning of the reference).