The project includes a database(here I use SQL server) from where questions and options will be fetched to the Windows form in Visual Studio under C#.
This code is based on following database architecture:
1. First of all, we have to include a namespace named SqlClient.
We are going to use a Label to fetch Questions and RadioButtons to fetch options.
The Basic code that run our program is as follows:
2. The above code fetches the Question and Its respective 4 options in the Windows Form.
3. We have added a timer from the toolbox and generate its click event by simply double clicking on the timer. This timer will decide "the time difference between two questions to be displayed on form after user select any radio button to answer the question.
4. This is the click event of a radio button where the main coding of "fetching next question" is done.
Similar code is performed in other three radio button except we increase the Row no. by one for each next row.
i.e for next check box, we will check " if(dt.Rows[i][3].ToString()== dt.Rows[i][6].ToString)"
and so on.
So, This is a short code for KBC project in c#.
Thank you.
This code is based on following database architecture:
Visual Studio c#.net:
1. First of all, we have to include a namespace named SqlClient.
The Basic code that run our program is as follows:
2. The above code fetches the Question and Its respective 4 options in the Windows Form.
3. We have added a timer from the toolbox and generate its click event by simply double clicking on the timer. This timer will decide "the time difference between two questions to be displayed on form after user select any radio button to answer the question.
4. This is the click event of a radio button where the main coding of "fetching next question" is done.
Similar code is performed in other three radio button except we increase the Row no. by one for each next row.
i.e for next check box, we will check " if(dt.Rows[i][3].ToString()== dt.Rows[i][6].ToString)"
and so on.
So, This is a short code for KBC project in c#.
Note: This code will fetch Question to a Label and options in Radio Box and also present next question in front of user whenever he/she gives the correct answer. You can also use Random Funtion to generate questions randomly but for that you will need to make more than one table for questions according to question difficulty level.
Thank you.
good one..! add some screenshots of the running code also.!!
ReplyDeleteSure :)
Delete