Database Reference
In-Depth Information
Try It: Setting the Start-up Form
Setting the start-up form in a Visual C# project is a little tricky, so I wanted to break it into its own
exercise. To set a start-up form, you need to follow these steps:
1. In the project you modified in the previous exercise, navigate to Solution
Explorer, open the Program.cs file, and look for the following code line:
Application.Run(new WinApp());
This code line ensures the WinApp form will be the first form to run all the time because this is the
first form called Form1, which was already added and you renamed it when you began this project; in
order to set the UserInfo form as the start-up form, you need to modify this statement a little, as follows:
Application.Run(new UserInfo());
2. Build the solution, and run and test the application by pressing Ctrl+F5. The
UserInfo application form will be loaded.
3. Enter a country and state name in the appropriate text boxes and click the Add
button; you will see that the names you entered have been added to the
ListBox and ComboBox, as shown in Figure 9-17.
Figure 9-17. Using ListBox and ComboBox withUserInfo Windows Forms application
4. Select both the CheckBoxes and one of the RadioButton, and click the
ShowDetails button; you will see that a message box is displayed, as shown in
Figure 9-18.
 
Search WWH ::




Custom Search