c# - Why I can't insert variable into if statement? -
one day made quiz here code:
public form1() { initializecomponent(); int currentques = 1; } private void button1_click(object sender, eventargs e) { string answer = textbox1.text; string correctans1 = "2"; if (textbox1.text == correctans1) { label2.text = string.format("successful!!!"); } else { label2.text = string.format("invalid!!!"); } if (currentques == 1) { label2.text = string.format("what 1+1?"); } } i got following error:
the name 'currentques' not exist in current context
why?
Comments
Post a Comment