0

Hello all!! I am trying to create a Windows Form Application that allows a user to answer 10 questions. The program contains a 'next button so that when the user clicks it, the next question appears. My problem is trying to figure out how to code for the next button. There is also a 'previous' button and I am not sure how to code the program so that the user can cycle through the questions. I have a label for the questions to appear in and want the next question to appear in the same label when the next button is clicked. Any ideas? Thanks!!

5
Contributors
4
Replies
48
Views
3 Years
Discussion Span
Last Post by kamilacbe
0

Are the questions all in an array? If they are, just have a counter that points to the current question. Initialize it to 0 to indicate the first question. When the Next button is pressed, increment the counter, if it exceeds the number of questions then reset it to 0 so that it starts all over again. Same with Presious button but decrement the counter. It's a pretty simple solution to implement.

0

do you need in c#.net (windows application) or asp.net & c#.net (web application)

Edited by Sulaiman_1

0

you can use a dictionary to make it more adaptive for future changes, meanwhile solve your current problem, the same way Ancient Dragon's approach.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.