vb.net - Using global variable to show value on progress bar -
i making game in visual basic 2010 , have completed except 1 problem have encountered in regards using global variables. have set them in module shown below:
module module1 public structure maths public accuracy integer public speed integer public vision integer end structure public mathsprogress maths end module
what trying these variables use them within 1 form store values can transfer values second form. this, have created nested if statements should set value of variable mathsprogress.accuracy = x
depending on value of 'incorrect'.
'''''''''''continued'''''''''''''''''' else : incorrect = incorrect + 1 if incorrect = 0 mathsprogress.accuracy = 10 elseif incorrect < 2 , incorrect > 0 mathsprogress.accuracy = 9 elseif incorrect = 3 mathsprogress.accuracy = 8 elseif incorrect = 4 mathsprogress.accuracy = 7 elseif incorrect = 5 mathsprogress.accuracy = 6 elseif incorrect = 6 mathsprogress.accuracy = 5 elseif incorrect = 7 mathsprogress.accuracy = 4 elseif incorrect = 8 mathsprogress.accuracy = 3 elseif incorrect = 9 mathsprogress.accuracy = 2 else mathsprogress.accuracy = 1 end if end if
but unknown reason, when use variable in second form supposed show value of 'mathsprogress.accuracy' in progressbar, says 'the value of 0 not valid, must between minimum , maximum' makes me think value stored if statement not being transferred third form. code in third form is:
private sub pbaccuracy_click(byval sender system.object, byval e system.eventargs) handles pbaccuracy.click pbaccuracy.value = mathsprogress.accuracy end sub
i know variables set correctly because works when set mathsprogress.accuracy = 10 within form load of first form. problem may lie in have placed chunk of if statements, can explain?
thanks
Comments
Post a Comment