hello guys,

i am creating a simple quiz on c# in visual studio. I am stuck in changing the page(switchig to next question) when one question is answered.

what should i do for that ? i tried by making a new form inside the previous one but its not a proper way to do it.
please suggest me some way.

Thanks in Advance.

Knowing what controls are on your form would be beneficial. The easiest way is probably to change the text on the control.

To add on cgeier's post:

A control is simply a "visual representation", a text box for example.
These have values associated with them, and you can change them quite easily.

In your case, instead of changing the entire page, you could change the value being stored by the text box / label, using this line of code:

Textbox.Text = "sometextyouwant";

the .Text prefix works for a number of different form controls, such as buttons, labels, and textboxes.

This method will be much quicker and easier to program.

you could save the value from the question in a static array list or dictionary<string,string> after that you could put your next question in same place as orignial by updating page with next question
add a static class to your project then you can add answers to it like the following
[static class name].[dictionary name].add([key item],answer)

Edited 2 Years Ago by Isaac_3

Create a control (ASP:Literal for example) for the next question text, and a radio-group for list of answer. When in .cs part you have processed the answer to your previous question, then just fill these controls with the next question data and return to your page.

This article has been dead for over six months. Start a new discussion instead.