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.

Recommended Answers

All 5 Replies

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

Member Avatar for humorousone

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)

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.