Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Microsoft C# Professional Projects - Premier Press.pdf
Скачиваний:
177
Добавлен:
24.05.2014
Размер:
14.65 Mб
Скачать

168 Project 1 CREATING A CUSTOMER MAINTENANCE PROJECT

Button2 control:

Name: btnEdit

Text: Edit

Button3 control:

Name: btnCancel

Text: Cancel

Button4 control:

Name: btnExit

 

LY

Text: Exit

 

 

 

 

 

F

 

 

M

You will change the properties of a DataGrid control later in this project. Figure

 

A

8-17 shows the WorkerForm with the controls added to the form.

 

E

 

T

 

 

FIGURE 8-17 WorkerForm with the controls

Creating an Interface for CustomerForm

CustomerForm is used to view, add, delete, or modify the records in the Customer table. To create the CustomerForm, perform the following steps:

1.Right-click on Customer Maintenance Project in the Solution Explorer window and select the Add option.

2.From the list that is displayed, select the Add New Item option. The Add New Item dialog box is displayed.

Team-Fly®

WINDOWS FORMS AND CONTROLS

Chapter 8

169

 

 

 

3.In the Templates: pane of the Add New Item dialog box, select the Windows Form icon.

4.In the Name text box, type the name of the form as CustomerForm and click on the Open button.

Visual Studio .NET creates a blank form with the name CustomerForm. You can now add controls to the form. To do this, perform the following steps.

1.Add four Label controls to the form.

2.In the Properties window, change the following properties of the controls:

Label1 control:

Name: lblCarNo

Text: Car No.

Label2 control:

Name: lblName

Text: Name

Label3 control:

Name: lblAddress

Text: Address

Label4 control:

Name: lblMake

Text: Make

3.Add five text boxes to the form.

You will change the properties of the text boxes after creating DataSet for the form.

4.Add six button controls to the form and change the following properties of the controls:

Button1 control:

Name: btnSave

Text: Save

Button2 control:

Name: btnEdit

Text: Edit

170 Project 1 CREATING A CUSTOMER MAINTENANCE PROJECT

Button3 control:

Name: btnCancel

Text: Cancel

Button4 control:

Name: btnExit

Text: Exit

Button5 control:

Name: btnPrevious

Text: Previous

Button6 control:

Name: btnNext

Text: Next

5.On the File menu, click on the Save option to save the form.

Figure 8-18 shows the layout of CustomerForm.

FIGURE 8-18 CustomerForm with the controls

Creating an Interface for ReportsForm

ReportsForm includes a GroupBox control that contains four radio buttons. You can select any radio button to generate a corresponding report. To create ReportsForm, add a new form to the project and name the form ReportsForm. You can now add controls to the form.

WINDOWS FORMS AND CONTROLS

Chapter 8

 

171

 

 

 

 

 

1.Add a Label control, a GroupBox, four radio buttons, and a button control to the form.

2.Change the following properties of the control in the Properties window. Label control:

Name: label1

Text: Select the radio button to generate the report.

Font:

Name: Microsoft Sans Serif

Size: 10

Bold: True

GroupBox control:

Name: groupBox1

Text: Reports:

RadioButton1 control:

Name: radioButton1

Text: Monthly Consumable Report

RadioButton2 control:

Name: radioButton2

Text: Monthly Consumer Visit Report

RadioButton3 control:

Name: radioButton3

Text: Monthly Balancing and Alignment Report

RadioButton4 control:

Name: radioButton4

Text: Monthly Worker Report

Button control:

Name: btnExit

Text: Exit

3.On the File menu, click on the Save option to save the form.

Figure 8-19 shows the interface of the ReportsForm.