vb.net - Addition and Subtraction of Random Numbers -


i trying make simple math game made of 3 forms. first form title screen has button start game. when button pressed make form 2 visible. form 2 generate 2 random numbers , either “+” or “-“ symbol , begin timer. user inputs answer text box , clicks “check answer” button, display either “correct” or “incorrect” label. want repeat 5 times , final time display form 3 show total time taken , number of correct answers.

so far in first form have:

public class startform public randomnumber new random()  private sub button1_click(byval sender system.object, byval e system.eventargs) handles button1.click      me.hide()     questionform.show()      questionform.num1.text = randomnumber.next(1, 100)     questionform.num2.text = randomnumber.next(1, 100)     questionform.mathsymbol.text = randomnumber.next(1, 10)      if questionform.mathsymbol.text = 1         questionform.mathsymbol.text = "+"     elseif questionform.mathsymbol.text = 2         questionform.mathsymbol.text = "+"     elseif questionform.mathsymbol.text = 3         questionform.mathsymbol.text = "+"     elseif questionform.mathsymbol.text = 4         questionform.mathsymbol.text = "+"     elseif questionform.mathsymbol.text = 5         questionform.mathsymbol.text = "+"     else         questionform.mathsymbol.text = "-"     end if  end sub  end class 

and in second form have:

public class questionform  public count integer = 0 public ans integer   private sub button1_click(byval sender system.object, byval e system.eventargs) handles button1.click      if mathsymbol.text = "+"         convert.toint32(num1.text)         convert.toint32(num2.text)         ans = num1.text + num2.text     else         ans = num1.text - num2.text     end if      if answerbox.text = ans         correctlabel.visible = true     else         incorrectlabel.visible = true     end if  end sub  end class 

this causes answer displayed "incorrect" should fix it? having trouble getting timer work.

thank you.


Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -