i have two tables one is quiz in which questions and the correct answer is stored
another table is result in which the answer given by user is stored.
there are total of 10 questions.
how to compare the correct answer and answer given by user and give 0.2 marks for every correct answer .
how can i do this in vb.net.
It looks as if you are creating four multiple choice answers. Then, the user has to select one of the answers and when they are done, they submit them? I mean, I am only guessing because you say you have two tables, but you want this done in Visual Basic, wouldn't the tables be in a database?
As an example, create a 'RadioButtonList' and put four 'RadioButtons' in there. If you really want to do all of this in visual basic, you would have to dynamically create a RadioButtonList and the four radio buttons, then add the radiobuttons to the list.
As far as validating the proper answer, set three of the buttons to some value such as "No" or -1. The right answer would be...the actual answer. Then, I don't know how you are storing the answers...you say a table. Just compare the value of the radiobutton that was selected with the answer.
The user will start off with a score of zero, and if the question is answered right, add .02 to the score.
If you want to be a little more specific as to how you are doing this (post your code here), I will fix it for you, or if you have no code and need somewhere to start, just ask and I will help you.
In your case you have two table.
I have done this using single table.
When user start Test that time one table contain Question,Ans1,Ans2,Ans3,Ans4,CorrectAns and SelectedAns.
When user press next button that time update SelectedAns field. Every time next button update that particular Row. When Press Finish or End Button that time calculate result using SelectedAns Field.
Try this. It's simple and Also easy to calculate result.
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)