Description
This code shows you how to validate data in Windows forms, add and remove panel control, and write a form based quiz application.
Some of the points this articles covers are:
- How to create GUI using Windows Form?
- How to validate form when user clicked on the submit Button?
- How to add panel and remove panel from the Form?
- How different objects are passed to the constructor and retrieve in to another class?
This program contains 4 classes
- app class is used to display login form for user where user can register as well as enter login id and password (which is provided by default amit/amit) as shown in the Screen shot1.
- Client class is used to display registration form for user. As shown in the Screen shot2.
- User and user1 classes are used to display all question to the user. And final window will display scoreboard to the user. As shown in the Screen shot 3.
- Scoreboard window is shown in the Screen shot4.
User and user1 extensively used panel Add and panel Remove methods.
Home page button is used to take user from question Window to login Window.
Events
radioButton3.CheckedChanged += new System.EventHandler(value);
Above code line is used to check whether radio button is selected or not and then call above event. In the event it will check if answer is correct or not.
Requirements
Following are the requirement to run this code:
- User should have SDK installed on his computer.
- Then just copy paste code or unzipped the code file and save as quiz.cs in respective directory
Steps for compilation and Running of this code
If you have SDK installed on your computer.
- Type command as csc and (program name)
csc quiz.cs
- Then type program name quiz.
Images
![](Images/QuizAp6.jpg)
Screen shot 1
![](Images/QuizAp7.jpg)
Screen shot2
![](Images/QuizAp8.jpg)
Screen shot 3
![](Images/QuizAp10.jpg)
Screen shot 4