Beruflich Dokumente
Kultur Dokumente
Factory
In this lab, you will create the user interface for a Virtual
Doughnut Factory application in Visual C#. Your application will
serve as a storefront and control panel for an automated doughnut
factory. You will add controls, menus, and implement validation.
Text
Size
480, 400 (approximately)
4. Locate static void Main() and change it so that it reads as
follows:
static void Main()
{
Application.Run(new frm<ID2>Main());
}
5. Add the controls listed in Table 2.3 to the form.
Table 2.3 Controls and Properties for frm<ID2>Main
Control
Label1
Control
Type
Label
Property
Value
Name
lblTitle
Text
Current Inventory
Font.Size 14
Label2
Label
Label3
Label
Label4
Label
Label5
Label
Font.Bold True
Name
lblRaised
Text
Raised
Name
lblCake
Text
Cake
Name
lblFilled
Text
Filled
Name
lblGlazedRaised
Text
Glazed
Control
Control
Type
TextBox1 TextBox
Label6
Label
TextBox2 TextBox
Label7
Label
TextBox3 TextBox
Label8
Label
TextBox4 TextBox
Property
Value
Name
txtGlazedRaised
Text
<blank>
ReadOnly
Name
Text
Name
True
lblSugarRaised
Sugar
txtSugarRaised
Text
<blank>
ReadOnly
Name
Text
Name
True
lblChocolateRaised
Chocolate
txtChocolateRaised
Text
<blank>
ReadOnly
Name
Text
Name
True
lblPlainCake
Plain
txtPlainCake
Text
<blank>
ReadOnly True
Label9
Label
TextBox5 TextBox
Label10
Label
TextBox6 TextBox
Label11
Label
Name
Text
Name
lblChocolateCake
Chocolate
txtChocolateCake
Text
<blank>
ReadOnly
Name
Text
Name
True
lblSugarCake
Sugar
txtSugarCake
Text
<blank>
ReadOnly True
Name
lblLemonFilled
Control
Control
Type
TextBox7 TextBox
Label12
Label
TextBox8 TextBox
Label13
Label
TextBox9 TextBox
Label14
Label
Label15
Label
Label16
Label
Label17
Label
TextBox10 TextBox
ComboBox1 ComboBox
TextBox11 TextBox
ListBox1 ListBox
Label18 Label
TextBox12 TextBox
Property
Value
Text
Name
Lemon
txtLemonFilled
Text
<blank>
ReadOnly
Name
Text
Name
True
lblGrapeFilled
Grape
txtGrapeFilled
Text
<blank>
ReadOnly
Name
Text
Name
True
lblCustardFilled
Custard
txtCustardFilled
Text
<blank>
ReadOnly
Name
Text
Name
Text
Name
Text
Name
Text
Name
Text
Name
Text
Name
True
lblSale
Current Sale
lblQuantity
Quantity
lblType
Type
lblPrice
Price
txtQuantity
0
cmbType
<blank>
txtPrice
Text
<blank>
ReadOnly
Name
Name
Text
Name
True
lstSale
lblTotal
Total
txtTotal
Control
Control
Type
Property
Text
Value
<blank>
ReadOnly True
Button1 Button
Name
btnAddToSale
Text
Add To Sale
Button2 Button
Name
btnRemoveItem
Text
Remove Item
Button3 Button
Name
btnCheckOut
Text
Check Out
6. In the Properties window, add the following strings to the
Items collection of cmbType: Raised-Glazed, Raised-Sugar,
Raised-Chocolate, Cake-Plain, Cake-Chocolate, Cake-Sugar,
Filled-Lemon, Filled-Grape, Filled-Custard.
When completed, your form should look something like Figure on
my ftp site named lab2.bmp.
Menu Item
&File
E&xit
&Doughnuts
&Make
&Remove Stale
&Customers
&Add a Customer
&View Customers
&Help
&About
&Contents
Name
mnuFile
mnuExit
mnuDoughnuts
mnuMake
mnuRemoveStale
mnuCustomers
mnuAddaCustomer
mnuViewCustomers
mnuHelp
mnuAbout
mnuContents
else
errorProvider1.SetError(txtQuantity, "");
}