470,631 Members | 1,621 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,631 developers. It's quick & easy.

My main menu is not showing up...

I was trying to work through the Lab 2 exercises in the Microsoft's
Windows-Based Applications in Visual C#. While I am not showing any errors
I am also not seeing the mainMenu object when I run the application.

I am wondering if someone could point out why in the code below:
using System;

using System.Drawing;

using System.Collections;

using System.ComponentModel;

using System.Windows.Forms;

using System.Data;

namespace Joe_s_Doughnut_Factory

{

/// <summary>

/// Summary description for Form1.

/// </summary>

public class frmMain : System.Windows.Forms.Form

{

private System.Windows.Forms.Label lblTitle;

private System.Windows.Forms.Label lblRaised;

private System.Windows.Forms.Label lblCake;

private System.Windows.Forms.Label lblFilled;

private System.Windows.Forms.Label lblGlazedRaised;

private System.Windows.Forms.Label lblSugarRaised;

private System.Windows.Forms.Label lblChocolateRaised;

private System.Windows.Forms.Label lblPlainCake;

private System.Windows.Forms.Label lblChocolateCake;

private System.Windows.Forms.Label lblSugarCake;

private System.Windows.Forms.Label lblLemonFilled;

private System.Windows.Forms.Label lblGrapeFilled;

private System.Windows.Forms.Label lblCustardFilled;

private System.Windows.Forms.TextBox txtGlazedRaised;

private System.Windows.Forms.TextBox txtSugarRaised;

private System.Windows.Forms.TextBox txtChocolateRaised;

private System.Windows.Forms.TextBox txtPlainCake;

private System.Windows.Forms.TextBox txtChocolateCake;

private System.Windows.Forms.TextBox txtSugarCake;

private System.Windows.Forms.TextBox txtLemonFilled;

private System.Windows.Forms.TextBox txtGrapeFilled;

private System.Windows.Forms.TextBox txtCustardFilled;

private System.Windows.Forms.Label lblCurrentSale;

private System.Windows.Forms.Label lblQuantitylblQuantity;

private System.Windows.Forms.Label lblType;

private System.Windows.Forms.Label lblPrice;

private System.Windows.Forms.Label lblTotal;

private System.Windows.Forms.TextBox txtQuantity;

private System.Windows.Forms.ComboBox cmbType;

private System.Windows.Forms.TextBox txtPrice;

private System.Windows.Forms.ListBox lstSale;

private System.Windows.Forms.Button btnAddToSale;

private System.Windows.Forms.Button btnRemoveItem;

private System.Windows.Forms.Button btnCheckOut;

private System.Windows.Forms.TextBox txtTotal;

private System.Windows.Forms.ErrorProvider errorProvider1;

private System.Windows.Forms.MainMenu mainMenu1;

private System.Windows.Forms.MenuItem mnuFile;

private System.Windows.Forms.MenuItem mnuExit;

private System.Windows.Forms.MenuItem mnuDoughnuts;

private System.Windows.Forms.MenuItem mnuCustomers;

private System.Windows.Forms.MenuItem mnuHelp;

private System.Windows.Forms.MenuItem mnuMake;

private System.Windows.Forms.MenuItem mnuRemoveStale;

private System.Windows.Forms.MenuItem mnuAddaCustomer;

private System.Windows.Forms.MenuItem mnuViewCustomers;

private System.Windows.Forms.MenuItem mnuAout;

private System.Windows.Forms.MenuItem mnuContents;

/// <summary>

/// Required designer variable.

/// </summary>

private System.ComponentModel.Container components = null;

public frmMain()

{

//

// Required for Windows Form Designer support

//

InitializeComponent();

//

// TODO: Add any constructor code after
InitializeComponent call

//

}

/// <summary>

/// Clean up any resources being used.

/// </summary>

protected override void Dispose( bool disposing )

{

if( disposing )

{

if (components != null)

{

components.Dispose();

}

}

base.Dispose( disposing );

}

#region Windows Form Designer generated code

/// <summary>

/// Required method for Designer support - do not modify

/// the contents of this method with the code editor.

/// </summary>

private void InitializeComponent()

{

this.lblTitle = new System.Windows.Forms.Label();

this.mainMenu1 = new System.Windows.Forms.MainMenu();

this.mnuFile = new System.Windows.Forms.MenuItem();

this.mnuExit = new System.Windows.Forms.MenuItem();

this.mnuDoughnuts = new System.Windows.Forms.MenuItem();

this.mnuMake = new System.Windows.Forms.MenuItem();

this.mnuRemoveStale = new System.Windows.Forms.MenuItem();

this.mnuCustomers = new System.Windows.Forms.MenuItem();

this.mnuAddaCustomer = new System.Windows.Forms.MenuItem();

this.mnuViewCustomers = new System.Windows.Forms.MenuItem();

this.mnuHelp = new System.Windows.Forms.MenuItem();

this.mnuAout = new System.Windows.Forms.MenuItem();

this.mnuContents = new System.Windows.Forms.MenuItem();

this.lblRaised = new System.Windows.Forms.Label();

this.lblCake = new System.Windows.Forms.Label();

this.lblFilled = new System.Windows.Forms.Label();

this.lblGlazedRaised = new System.Windows.Forms.Label();

this.lblSugarRaised = new System.Windows.Forms.Label();

this.lblChocolateRaised = new System.Windows.Forms.Label();

this.lblPlainCake = new System.Windows.Forms.Label();

this.lblChocolateCake = new System.Windows.Forms.Label();

this.lblSugarCake = new System.Windows.Forms.Label();

this.lblLemonFilled = new System.Windows.Forms.Label();

this.lblGrapeFilled = new System.Windows.Forms.Label();

this.lblCustardFilled = new System.Windows.Forms.Label();

this.txtGlazedRaised = new System.Windows.Forms.TextBox();

this.txtSugarRaised = new System.Windows.Forms.TextBox();

this.txtChocolateRaised = new System.Windows.Forms.TextBox();

this.txtPlainCake = new System.Windows.Forms.TextBox();

this.txtChocolateCake = new System.Windows.Forms.TextBox();

this.txtSugarCake = new System.Windows.Forms.TextBox();

this.txtLemonFilled = new System.Windows.Forms.TextBox();

this.txtGrapeFilled = new System.Windows.Forms.TextBox();

this.txtCustardFilled = new System.Windows.Forms.TextBox();

this.lblCurrentSale = new System.Windows.Forms.Label();

this.lblQuantitylblQuantity = new System.Windows.Forms.Label();

this.lblType = new System.Windows.Forms.Label();

this.lblPrice = new System.Windows.Forms.Label();

this.lblTotal = new System.Windows.Forms.Label();

this.txtQuantity = new System.Windows.Forms.TextBox();

this.cmbType = new System.Windows.Forms.ComboBox();

this.txtPrice = new System.Windows.Forms.TextBox();

this.lstSale = new System.Windows.Forms.ListBox();

this.btnAddToSale = new System.Windows.Forms.Button();

this.btnRemoveItem = new System.Windows.Forms.Button();

this.btnCheckOut = new System.Windows.Forms.Button();

this.txtTotal = new System.Windows.Forms.TextBox();

this.errorProvider1 = new System.Windows.Forms.ErrorProvider();

this.SuspendLayout();

//

// lblTitle

//

this.lblTitle.Font = new System.Drawing.Font("Tahoma", 14.25F,
System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
((System.Byte)(0)));

this.lblTitle.Location = new System.Drawing.Point(136, 16);

this.lblTitle.Name = "lblTitle";

this.lblTitle.Size = new System.Drawing.Size(192, 23);

this.lblTitle.TabIndex = 0;

this.lblTitle.Text = "Current Inventory";

this.lblTitle.TextAlign =
System.Drawing.ContentAlignment.MiddleCenter;

//

// mainMenu1

//

this.mainMenu1.MenuItems.AddRange(new
System.Windows.Forms.MenuItem[] {

this.mnuFile,

this.mnuDoughnuts,

this.mnuCustomers,

this.mnuHelp});

//

// mnuFile

//

this.mnuFile.Index = 0;

this.mnuFile.MenuItems.AddRange(new System.Windows.Forms.MenuItem[]
{

this.mnuExit});

this.mnuFile.Text = "&File";

//

// mnuExit

//

this.mnuExit.Index = 0;

this.mnuExit.Text = "E&xit";

this.mnuExit.Click += new System.EventHandler(this.mnuExit_Click);

//

// mnuDoughnuts

//

this.mnuDoughnuts.Index = 1;

this.mnuDoughnuts.MenuItems.AddRange(new
System.Windows.Forms.MenuItem[] {
this.mnuMake,
this.mnuRemoveStale});

this.mnuDoughnuts.Text = "&Doughnuts";

//

// mnuMake

//

this.mnuMake.Index = 0;

this.mnuMake.Text = "&Make";

//

// mnuRemoveStale

//

this.mnuRemoveStale.Index = 1;

this.mnuRemoveStale.Text = "&Remove Stale";

//

// mnuCustomers

//

this.mnuCustomers.Index = 2;

this.mnuCustomers.MenuItems.AddRange(new
System.Windows.Forms.MenuItem[] {
this.mnuAddaCustomer,
this.mnuViewCustomers});

this.mnuCustomers.Text = "&Customers";

//

// mnuAddaCustomer

//

this.mnuAddaCustomer.Index = 0;

this.mnuAddaCustomer.Text = "&Add a Customer";

//

// mnuViewCustomers

//

this.mnuViewCustomers.Index = 1;

this.mnuViewCustomers.Text = "&View Customers";

//

// mnuHelp

//

this.mnuHelp.Index = 3;

this.mnuHelp.MenuItems.AddRange(new System.Windows.Forms.MenuItem[]
{
this.mnuAout,
this.mnuContents});

this.mnuHelp.Text = "&Help";

//

// mnuAout

//

this.mnuAout.Index = 0;

this.mnuAout.Text = "&About";

//

// mnuContents

//

this.mnuContents.Index = 1;

this.mnuContents.Text = "&Contents";

//

// lblRaised

//

this.lblRaised.Location = new System.Drawing.Point(16, 48);

this.lblRaised.Name = "lblRaised";

this.lblRaised.TabIndex = 1;

this.lblRaised.Text = "Raised";

this.lblRaised.TextAlign =
System.Drawing.ContentAlignment.MiddleLeft;

//

// lblCake

//

this.lblCake.Location = new System.Drawing.Point(160, 48);

this.lblCake.Name = "lblCake";

this.lblCake.TabIndex = 2;

this.lblCake.Text = "Cake";

this.lblCake.TextAlign =
System.Drawing.ContentAlignment.MiddleLeft;

//

// lblFilled

//

this.lblFilled.Location = new System.Drawing.Point(312, 48);

this.lblFilled.Name = "lblFilled";

this.lblFilled.TabIndex = 3;

this.lblFilled.Text = "Filled";

this.lblFilled.TextAlign =
System.Drawing.ContentAlignment.MiddleLeft;

//

// lblGlazedRaised

//

this.lblGlazedRaised.Location = new System.Drawing.Point(16, 80);

this.lblGlazedRaised.Name = "lblGlazedRaised";

this.lblGlazedRaised.TabIndex = 4;

this.lblGlazedRaised.Text = "Glazed";

this.lblGlazedRaised.TextAlign =
System.Drawing.ContentAlignment.MiddleLeft;

//

// lblSugarRaised

//

this.lblSugarRaised.Location = new System.Drawing.Point(16, 112);

this.lblSugarRaised.Name = "lblSugarRaised";

this.lblSugarRaised.TabIndex = 5;

this.lblSugarRaised.Text = "Sugar";

this.lblSugarRaised.TextAlign =
System.Drawing.ContentAlignment.MiddleLeft;

//

// lblChocolateRaised

//

this.lblChocolateRaised.Location = new System.Drawing.Point(16,
144);

this.lblChocolateRaised.Name = "lblChocolateRaised";

this.lblChocolateRaised.TabIndex = 6;

this.lblChocolateRaised.Text = "Chocolate";

this.lblChocolateRaised.TextAlign =
System.Drawing.ContentAlignment.MiddleLeft;

//

// lblPlainCake

//

this.lblPlainCake.Location = new System.Drawing.Point(160, 80);

this.lblPlainCake.Name = "lblPlainCake";

this.lblPlainCake.TabIndex = 7;

this.lblPlainCake.Text = "Plain";

this.lblPlainCake.TextAlign =
System.Drawing.ContentAlignment.MiddleLeft;

//

// lblChocolateCake

//

this.lblChocolateCake.Location = new System.Drawing.Point(160,
112);

this.lblChocolateCake.Name = "lblChocolateCake";

this.lblChocolateCake.TabIndex = 8;

this.lblChocolateCake.Text = "Chocolate";

this.lblChocolateCake.TextAlign =
System.Drawing.ContentAlignment.MiddleLeft;

//

// lblSugarCake

//

this.lblSugarCake.Location = new System.Drawing.Point(160, 144);

this.lblSugarCake.Name = "lblSugarCake";

this.lblSugarCake.TabIndex = 9;

this.lblSugarCake.Text = "Sugar";

this.lblSugarCake.TextAlign =
System.Drawing.ContentAlignment.MiddleLeft;

//

// lblLemonFilled

//

this.lblLemonFilled.Location = new System.Drawing.Point(312, 80);

this.lblLemonFilled.Name = "lblLemonFilled";

this.lblLemonFilled.TabIndex = 10;

this.lblLemonFilled.Text = "Lemon";

this.lblLemonFilled.TextAlign =
System.Drawing.ContentAlignment.MiddleLeft;

//

// lblGrapeFilled

//

this.lblGrapeFilled.Location = new System.Drawing.Point(312, 112);

this.lblGrapeFilled.Name = "lblGrapeFilled";

this.lblGrapeFilled.TabIndex = 11;

this.lblGrapeFilled.Text = "Grape";

this.lblGrapeFilled.TextAlign =
System.Drawing.ContentAlignment.MiddleLeft;

//

// lblCustardFilled

//

this.lblCustardFilled.Location = new System.Drawing.Point(312,
144);

this.lblCustardFilled.Name = "lblCustardFilled";

this.lblCustardFilled.TabIndex = 12;

this.lblCustardFilled.Text = "Custard";

this.lblCustardFilled.TextAlign =
System.Drawing.ContentAlignment.MiddleLeft;

//

// txtGlazedRaised

//

this.txtGlazedRaised.BackColor =
System.Drawing.SystemColors.Window;

this.txtGlazedRaised.Location = new System.Drawing.Point(120, 80);

this.txtGlazedRaised.Name = "txtGlazedRaised";

this.txtGlazedRaised.ReadOnly = true;

this.txtGlazedRaised.Size = new System.Drawing.Size(24, 21);

this.txtGlazedRaised.TabIndex = 13;

this.txtGlazedRaised.Text = "";

//

// txtSugarRaised

//

this.txtSugarRaised.BackColor = System.Drawing.SystemColors.Window;

this.txtSugarRaised.Location = new System.Drawing.Point(120, 112);

this.txtSugarRaised.Name = "txtSugarRaised";

this.txtSugarRaised.ReadOnly = true;

this.txtSugarRaised.Size = new System.Drawing.Size(24, 21);

this.txtSugarRaised.TabIndex = 14;

this.txtSugarRaised.Text = "";

//

// txtChocolateRaised

//

this.txtChocolateRaised.BackColor =
System.Drawing.SystemColors.Window;

this.txtChocolateRaised.Location = new System.Drawing.Point(120,
144);

this.txtChocolateRaised.Name = "txtChocolateRaised";

this.txtChocolateRaised.ReadOnly = true;

this.txtChocolateRaised.Size = new System.Drawing.Size(24, 21);

this.txtChocolateRaised.TabIndex = 15;

this.txtChocolateRaised.Text = "";

//

// txtPlainCake

//

this.txtPlainCake.BackColor = System.Drawing.SystemColors.Window;

this.txtPlainCake.Location = new System.Drawing.Point(264, 80);

this.txtPlainCake.Name = "txtPlainCake";

this.txtPlainCake.ReadOnly = true;

this.txtPlainCake.Size = new System.Drawing.Size(24, 21);

this.txtPlainCake.TabIndex = 16;

this.txtPlainCake.Text = "";

//

// txtChocolateCake

//

this.txtChocolateCake.BackColor =
System.Drawing.SystemColors.Window;

this.txtChocolateCake.Location = new System.Drawing.Point(264,
112);

this.txtChocolateCake.Name = "txtChocolateCake";

this.txtChocolateCake.ReadOnly = true;

this.txtChocolateCake.Size = new System.Drawing.Size(24, 21);

this.txtChocolateCake.TabIndex = 17;

this.txtChocolateCake.Text = "";

//

// txtSugarCake

//

this.txtSugarCake.BackColor = System.Drawing.SystemColors.Window;

this.txtSugarCake.Location = new System.Drawing.Point(264, 144);

this.txtSugarCake.Name = "txtSugarCake";

this.txtSugarCake.ReadOnly = true;

this.txtSugarCake.Size = new System.Drawing.Size(24, 21);

this.txtSugarCake.TabIndex = 18;

this.txtSugarCake.Text = "";

//

// txtLemonFilled

//

this.txtLemonFilled.BackColor = System.Drawing.SystemColors.Window;

this.txtLemonFilled.Location = new System.Drawing.Point(416, 80);

this.txtLemonFilled.Name = "txtLemonFilled";

this.txtLemonFilled.ReadOnly = true;

this.txtLemonFilled.Size = new System.Drawing.Size(24, 21);

this.txtLemonFilled.TabIndex = 19;

this.txtLemonFilled.Text = "";

//

// txtGrapeFilled

//

this.txtGrapeFilled.BackColor = System.Drawing.SystemColors.Window;

this.txtGrapeFilled.Location = new System.Drawing.Point(416, 112);

this.txtGrapeFilled.Name = "txtGrapeFilled";

this.txtGrapeFilled.ReadOnly = true;

this.txtGrapeFilled.Size = new System.Drawing.Size(24, 21);

this.txtGrapeFilled.TabIndex = 20;

this.txtGrapeFilled.Text = "";

//

// txtCustardFilled

//

this.txtCustardFilled.BackColor =
System.Drawing.SystemColors.Window;

this.txtCustardFilled.Location = new System.Drawing.Point(416,
144);

this.txtCustardFilled.Name = "txtCustardFilled";

this.txtCustardFilled.ReadOnly = true;

this.txtCustardFilled.Size = new System.Drawing.Size(24, 21);

this.txtCustardFilled.TabIndex = 21;

this.txtCustardFilled.Text = "";

//

// lblCurrentSale

//

this.lblCurrentSale.Location = new System.Drawing.Point(16, 176);

this.lblCurrentSale.Name = "lblCurrentSale";

this.lblCurrentSale.TabIndex = 22;

this.lblCurrentSale.Text = "Current Sales";

this.lblCurrentSale.TextAlign =
System.Drawing.ContentAlignment.MiddleLeft;

//

// lblQuantitylblQuantity

//

this.lblQuantitylblQuantity.Location = new System.Drawing.Point(16,
208);

this.lblQuantitylblQuantity.Name = "lblQuantitylblQuantity";

this.lblQuantitylblQuantity.TabIndex = 23;

this.lblQuantitylblQuantity.Text = "Quantity";

this.lblQuantitylblQuantity.TextAlign =
System.Drawing.ContentAlignment.MiddleLeft;

//

// lblType

//

this.lblType.Location = new System.Drawing.Point(136, 208);

this.lblType.Name = "lblType";

this.lblType.TabIndex = 24;

this.lblType.Text = "Type";

this.lblType.TextAlign =
System.Drawing.ContentAlignment.MiddleLeft;

//

// lblPrice

//

this.lblPrice.Location = new System.Drawing.Point(248, 208);

this.lblPrice.Name = "lblPrice";

this.lblPrice.TabIndex = 25;

this.lblPrice.Text = "Price";

this.lblPrice.TextAlign =
System.Drawing.ContentAlignment.MiddleLeft;

//

// lblTotal

//

this.lblTotal.Location = new System.Drawing.Point(144, 336);

this.lblTotal.Name = "lblTotal";

this.lblTotal.TabIndex = 26;

this.lblTotal.Text = "Total";

this.lblTotal.TextAlign =
System.Drawing.ContentAlignment.MiddleLeft;

//

// txtQuantity

//

this.txtQuantity.Location = new System.Drawing.Point(16, 232);

this.txtQuantity.Name = "txtQuantity";

this.txtQuantity.TabIndex = 27;

this.txtQuantity.Text = "";

this.txtQuantity.KeyPress += new
System.Windows.Forms.KeyPressEventHandler(this.txt Quantity_KeyPress);

this.txtQuantity.Validating += new
System.ComponentModel.CancelEventHandler(this.txtQ uantity_Validating);

//

// cmbType

//

this.cmbType.Items.AddRange(new object[] {

"Raised-Glazed",

"Raised-Sugar",

"Raised-Chocolate",

"Cake-Plain",

"Cake-Chocolate",

"Cake-Sugar",

"Filled-Lemon",

"Filled-Grape",

"Filled-Custard"});

this.cmbType.Location = new System.Drawing.Point(136, 232);

this.cmbType.Name = "cmbType";

this.cmbType.Size = new System.Drawing.Size(104, 21);

this.cmbType.TabIndex = 28;

//

// txtPrice

//

this.txtPrice.Location = new System.Drawing.Point(256, 232);

this.txtPrice.Name = "txtPrice";

this.txtPrice.ReadOnly = true;

this.txtPrice.TabIndex = 29;

this.txtPrice.Text = "";

//

// lstSale

//

this.lstSale.Location = new System.Drawing.Point(16, 264);

this.lstSale.Name = "lstSale";

this.lstSale.Size = new System.Drawing.Size(344, 56);

this.lstSale.TabIndex = 30;

//

// btnAddToSale

//

this.btnAddToSale.Location = new System.Drawing.Point(376, 232);

this.btnAddToSale.Name = "btnAddToSale";

this.btnAddToSale.Size = new System.Drawing.Size(80, 23);

this.btnAddToSale.TabIndex = 31;

this.btnAddToSale.Text = "Add to Sale";

//

// btnRemoveItem

//

this.btnRemoveItem.Location = new System.Drawing.Point(376, 264);

this.btnRemoveItem.Name = "btnRemoveItem";

this.btnRemoveItem.Size = new System.Drawing.Size(80, 23);

this.btnRemoveItem.TabIndex = 32;

this.btnRemoveItem.Text = "Remove Item";

//

// btnCheckOut

//

this.btnCheckOut.Location = new System.Drawing.Point(376, 336);

this.btnCheckOut.Name = "btnCheckOut";

this.btnCheckOut.Size = new System.Drawing.Size(80, 23);

this.btnCheckOut.TabIndex = 33;

this.btnCheckOut.Text = "Check Out";

//

// txtTotal

//

this.txtTotal.Location = new System.Drawing.Point(256, 336);

this.txtTotal.Name = "txtTotal";

this.txtTotal.ReadOnly = true;

this.txtTotal.TabIndex = 34;

this.txtTotal.Text = "";

//

// errorProvider1

//

this.errorProvider1.ContainerControl = this;

//

// frmMain

//

this.AutoScaleBaseSize = new System.Drawing.Size(5, 14);

this.BackColor = System.Drawing.SystemColors.Menu;

this.ClientSize = new System.Drawing.Size(472, 373);

this.Font = new System.Drawing.Font("Tahoma", 8.25F,
System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point,
((System.Byte)(0)));

this.Controls.Add(this.txtTotal);

this.Controls.Add(this.btnCheckOut);

this.Controls.Add(this.btnRemoveItem);

this.Controls.Add(this.btnAddToSale);

this.Controls.Add(this.lstSale);

this.Controls.Add(this.txtPrice);

this.Controls.Add(this.cmbType);

this.Controls.Add(this.txtQuantity);

this.Controls.Add(this.lblTotal);

this.Controls.Add(this.lblPrice);

this.Controls.Add(this.lblType);

this.Controls.Add(this.lblQuantitylblQuantity);

this.Controls.Add(this.lblCurrentSale);

this.Controls.Add(this.txtCustardFilled);

this.Controls.Add(this.txtGrapeFilled);

this.Controls.Add(this.txtLemonFilled);

this.Controls.Add(this.txtSugarCake);

this.Controls.Add(this.txtChocolateCake);

this.Controls.Add(this.txtPlainCake);

this.Controls.Add(this.txtChocolateRaised);

this.Controls.Add(this.txtSugarRaised);

this.Controls.Add(this.txtGlazedRaised);

this.Controls.Add(this.lblCustardFilled);

this.Controls.Add(this.lblGrapeFilled);

this.Controls.Add(this.lblLemonFilled);

this.Controls.Add(this.lblSugarCake);

this.Controls.Add(this.lblChocolateCake);

this.Controls.Add(this.lblPlainCake);

this.Controls.Add(this.lblChocolateRaised);

this.Controls.Add(this.lblSugarRaised);

this.Controls.Add(this.lblGlazedRaised);

this.Controls.Add(this.lblFilled);

this.Controls.Add(this.lblCake);

this.Controls.Add(this.lblRaised);

this.Controls.Add(this.lblTitle);

this.Name = "frmMain";

this.Text = "Joe\'s Doughnut Factory";

this.ResumeLayout(false);

}

#endregion

/// <summary>

/// The main entry point for the application.

/// </summary>

[STAThread]

static void Main()

{

Application.Run(new frmMain());

}

private void mnuExit_Click(object sender, System.EventArgs e)

{

this.Close();

}

private void txtQuantity_Validating(object sender,
System.ComponentModel.CancelEventArgs e)

{

// Test that txtQuantity is not empty

if (txtQuantity.Text == "")

{

errorProvider1.SetError(txtQuantity,"Please enter a
quantity");

e.Cancel = true;

}

//Tests that there are no other errors in txtQuantity

else if ( errorProvider1.GetError(txtQuantity) != "")

e.Cancel = true;

else

errorProvider1.SetError(txtQuantity,"");

}

private void txtQuantity_KeyPress(object sender,
System.Windows.Forms.KeyPressEventArgs e)

{

if (char.IsDigit(e.KeyChar)== false)

errorProvider1.SetError(txtQuantity,"Please enter a numeric
value.");

else

errorProvider1.SetError(txtQuantity,"");

}

}

}


Nov 17 '05 #1
1 2878
There's one line missing...

this.Name = "frmMain";
this.Text = "Joe\'s Doughnut Factory";
this.Menu = this.mainMenu1; // this one!

Regards,
--
Angel J. HernŠndez M.
MCP - MCAD - MCSD - MCDBA
http://groups.msn.com/desarrolladoresmiranda

"Henry" <hs****@onproject.com> wrote in message
news:e$**************@TK2MSFTNGP12.phx.gbl...
I was trying to work through the Lab 2 exercises in the Microsoft's
Windows-Based Applications in Visual C#. While I am not showing any errors
I am also not seeing the mainMenu object when I run the application.

I am wondering if someone could point out why in the code below:
using System;

using System.Drawing;

using System.Collections;

using System.ComponentModel;

using System.Windows.Forms;

using System.Data;

namespace Joe_s_Doughnut_Factory

{

/// <summary>

/// Summary description for Form1.

/// </summary>

public class frmMain : System.Windows.Forms.Form

{

private System.Windows.Forms.Label lblTitle;

private System.Windows.Forms.Label lblRaised;

private System.Windows.Forms.Label lblCake;

private System.Windows.Forms.Label lblFilled;

private System.Windows.Forms.Label lblGlazedRaised;

private System.Windows.Forms.Label lblSugarRaised;

private System.Windows.Forms.Label lblChocolateRaised;

private System.Windows.Forms.Label lblPlainCake;

private System.Windows.Forms.Label lblChocolateCake;

private System.Windows.Forms.Label lblSugarCake;

private System.Windows.Forms.Label lblLemonFilled;

private System.Windows.Forms.Label lblGrapeFilled;

private System.Windows.Forms.Label lblCustardFilled;

private System.Windows.Forms.TextBox txtGlazedRaised;

private System.Windows.Forms.TextBox txtSugarRaised;

private System.Windows.Forms.TextBox txtChocolateRaised;

private System.Windows.Forms.TextBox txtPlainCake;

private System.Windows.Forms.TextBox txtChocolateCake;

private System.Windows.Forms.TextBox txtSugarCake;

private System.Windows.Forms.TextBox txtLemonFilled;

private System.Windows.Forms.TextBox txtGrapeFilled;

private System.Windows.Forms.TextBox txtCustardFilled;

private System.Windows.Forms.Label lblCurrentSale;

private System.Windows.Forms.Label lblQuantitylblQuantity;

private System.Windows.Forms.Label lblType;

private System.Windows.Forms.Label lblPrice;

private System.Windows.Forms.Label lblTotal;

private System.Windows.Forms.TextBox txtQuantity;

private System.Windows.Forms.ComboBox cmbType;

private System.Windows.Forms.TextBox txtPrice;

private System.Windows.Forms.ListBox lstSale;

private System.Windows.Forms.Button btnAddToSale;

private System.Windows.Forms.Button btnRemoveItem;

private System.Windows.Forms.Button btnCheckOut;

private System.Windows.Forms.TextBox txtTotal;

private System.Windows.Forms.ErrorProvider errorProvider1;

private System.Windows.Forms.MainMenu mainMenu1;

private System.Windows.Forms.MenuItem mnuFile;

private System.Windows.Forms.MenuItem mnuExit;

private System.Windows.Forms.MenuItem mnuDoughnuts;

private System.Windows.Forms.MenuItem mnuCustomers;

private System.Windows.Forms.MenuItem mnuHelp;

private System.Windows.Forms.MenuItem mnuMake;

private System.Windows.Forms.MenuItem mnuRemoveStale;

private System.Windows.Forms.MenuItem mnuAddaCustomer;

private System.Windows.Forms.MenuItem mnuViewCustomers;

private System.Windows.Forms.MenuItem mnuAout;

private System.Windows.Forms.MenuItem mnuContents;

/// <summary>

/// Required designer variable.

/// </summary>

private System.ComponentModel.Container components = null;

public frmMain()

{

//

// Required for Windows Form Designer support

//

InitializeComponent();

//

// TODO: Add any constructor code after
InitializeComponent call

//

}

/// <summary>

/// Clean up any resources being used.

/// </summary>

protected override void Dispose( bool disposing )

{

if( disposing )

{

if (components != null)

{

components.Dispose();

}

}

base.Dispose( disposing );

}

#region Windows Form Designer generated code

/// <summary>

/// Required method for Designer support - do not modify

/// the contents of this method with the code editor.

/// </summary>

private void InitializeComponent()

{

this.lblTitle = new System.Windows.Forms.Label();

this.mainMenu1 = new System.Windows.Forms.MainMenu();

this.mnuFile = new System.Windows.Forms.MenuItem();

this.mnuExit = new System.Windows.Forms.MenuItem();

this.mnuDoughnuts = new System.Windows.Forms.MenuItem();

this.mnuMake = new System.Windows.Forms.MenuItem();

this.mnuRemoveStale = new System.Windows.Forms.MenuItem();

this.mnuCustomers = new System.Windows.Forms.MenuItem();

this.mnuAddaCustomer = new System.Windows.Forms.MenuItem();

this.mnuViewCustomers = new System.Windows.Forms.MenuItem();

this.mnuHelp = new System.Windows.Forms.MenuItem();

this.mnuAout = new System.Windows.Forms.MenuItem();

this.mnuContents = new System.Windows.Forms.MenuItem();

this.lblRaised = new System.Windows.Forms.Label();

this.lblCake = new System.Windows.Forms.Label();

this.lblFilled = new System.Windows.Forms.Label();

this.lblGlazedRaised = new System.Windows.Forms.Label();

this.lblSugarRaised = new System.Windows.Forms.Label();

this.lblChocolateRaised = new System.Windows.Forms.Label();

this.lblPlainCake = new System.Windows.Forms.Label();

this.lblChocolateCake = new System.Windows.Forms.Label();

this.lblSugarCake = new System.Windows.Forms.Label();

this.lblLemonFilled = new System.Windows.Forms.Label();

this.lblGrapeFilled = new System.Windows.Forms.Label();

this.lblCustardFilled = new System.Windows.Forms.Label();

this.txtGlazedRaised = new System.Windows.Forms.TextBox();

this.txtSugarRaised = new System.Windows.Forms.TextBox();

this.txtChocolateRaised = new System.Windows.Forms.TextBox();

this.txtPlainCake = new System.Windows.Forms.TextBox();

this.txtChocolateCake = new System.Windows.Forms.TextBox();

this.txtSugarCake = new System.Windows.Forms.TextBox();

this.txtLemonFilled = new System.Windows.Forms.TextBox();

this.txtGrapeFilled = new System.Windows.Forms.TextBox();

this.txtCustardFilled = new System.Windows.Forms.TextBox();

this.lblCurrentSale = new System.Windows.Forms.Label();

this.lblQuantitylblQuantity = new System.Windows.Forms.Label();

this.lblType = new System.Windows.Forms.Label();

this.lblPrice = new System.Windows.Forms.Label();

this.lblTotal = new System.Windows.Forms.Label();

this.txtQuantity = new System.Windows.Forms.TextBox();

this.cmbType = new System.Windows.Forms.ComboBox();

this.txtPrice = new System.Windows.Forms.TextBox();

this.lstSale = new System.Windows.Forms.ListBox();

this.btnAddToSale = new System.Windows.Forms.Button();

this.btnRemoveItem = new System.Windows.Forms.Button();

this.btnCheckOut = new System.Windows.Forms.Button();

this.txtTotal = new System.Windows.Forms.TextBox();

this.errorProvider1 = new System.Windows.Forms.ErrorProvider();

this.SuspendLayout();

//

// lblTitle

//

this.lblTitle.Font = new System.Drawing.Font("Tahoma", 14.25F,
System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
((System.Byte)(0)));

this.lblTitle.Location = new System.Drawing.Point(136, 16);

this.lblTitle.Name = "lblTitle";

this.lblTitle.Size = new System.Drawing.Size(192, 23);

this.lblTitle.TabIndex = 0;

this.lblTitle.Text = "Current Inventory";

this.lblTitle.TextAlign =
System.Drawing.ContentAlignment.MiddleCenter;

//

// mainMenu1

//

this.mainMenu1.MenuItems.AddRange(new
System.Windows.Forms.MenuItem[] {

this.mnuFile,

this.mnuDoughnuts,

this.mnuCustomers,

this.mnuHelp});

//

// mnuFile

//

this.mnuFile.Index = 0;

this.mnuFile.MenuItems.AddRange(new
System.Windows.Forms.MenuItem[] {

this.mnuExit});

this.mnuFile.Text = "&File";

//

// mnuExit

//

this.mnuExit.Index = 0;

this.mnuExit.Text = "E&xit";

this.mnuExit.Click += new System.EventHandler(this.mnuExit_Click);

//

// mnuDoughnuts

//

this.mnuDoughnuts.Index = 1;

this.mnuDoughnuts.MenuItems.AddRange(new
System.Windows.Forms.MenuItem[] {
this.mnuMake,
this.mnuRemoveStale});

this.mnuDoughnuts.Text = "&Doughnuts";

//

// mnuMake

//

this.mnuMake.Index = 0;

this.mnuMake.Text = "&Make";

//

// mnuRemoveStale

//

this.mnuRemoveStale.Index = 1;

this.mnuRemoveStale.Text = "&Remove Stale";

//

// mnuCustomers

//

this.mnuCustomers.Index = 2;

this.mnuCustomers.MenuItems.AddRange(new
System.Windows.Forms.MenuItem[] {
this.mnuAddaCustomer,
this.mnuViewCustomers});

this.mnuCustomers.Text = "&Customers";

//

// mnuAddaCustomer

//

this.mnuAddaCustomer.Index = 0;

this.mnuAddaCustomer.Text = "&Add a Customer";

//

// mnuViewCustomers

//

this.mnuViewCustomers.Index = 1;

this.mnuViewCustomers.Text = "&View Customers";

//

// mnuHelp

//

this.mnuHelp.Index = 3;

this.mnuHelp.MenuItems.AddRange(new
System.Windows.Forms.MenuItem[] {
this.mnuAout,
this.mnuContents});

this.mnuHelp.Text = "&Help";

//

// mnuAout

//

this.mnuAout.Index = 0;

this.mnuAout.Text = "&About";

//

// mnuContents

//

this.mnuContents.Index = 1;

this.mnuContents.Text = "&Contents";

//

// lblRaised

//

this.lblRaised.Location = new System.Drawing.Point(16, 48);

this.lblRaised.Name = "lblRaised";

this.lblRaised.TabIndex = 1;

this.lblRaised.Text = "Raised";

this.lblRaised.TextAlign =
System.Drawing.ContentAlignment.MiddleLeft;

//

// lblCake

//

this.lblCake.Location = new System.Drawing.Point(160, 48);

this.lblCake.Name = "lblCake";

this.lblCake.TabIndex = 2;

this.lblCake.Text = "Cake";

this.lblCake.TextAlign =
System.Drawing.ContentAlignment.MiddleLeft;

//

// lblFilled

//

this.lblFilled.Location = new System.Drawing.Point(312, 48);

this.lblFilled.Name = "lblFilled";

this.lblFilled.TabIndex = 3;

this.lblFilled.Text = "Filled";

this.lblFilled.TextAlign =
System.Drawing.ContentAlignment.MiddleLeft;

//

// lblGlazedRaised

//

this.lblGlazedRaised.Location = new System.Drawing.Point(16, 80);

this.lblGlazedRaised.Name = "lblGlazedRaised";

this.lblGlazedRaised.TabIndex = 4;

this.lblGlazedRaised.Text = "Glazed";

this.lblGlazedRaised.TextAlign =
System.Drawing.ContentAlignment.MiddleLeft;

//

// lblSugarRaised

//

this.lblSugarRaised.Location = new System.Drawing.Point(16, 112);

this.lblSugarRaised.Name = "lblSugarRaised";

this.lblSugarRaised.TabIndex = 5;

this.lblSugarRaised.Text = "Sugar";

this.lblSugarRaised.TextAlign =
System.Drawing.ContentAlignment.MiddleLeft;

//

// lblChocolateRaised

//

this.lblChocolateRaised.Location = new System.Drawing.Point(16,
144);

this.lblChocolateRaised.Name = "lblChocolateRaised";

this.lblChocolateRaised.TabIndex = 6;

this.lblChocolateRaised.Text = "Chocolate";

this.lblChocolateRaised.TextAlign =
System.Drawing.ContentAlignment.MiddleLeft;

//

// lblPlainCake

//

this.lblPlainCake.Location = new System.Drawing.Point(160, 80);

this.lblPlainCake.Name = "lblPlainCake";

this.lblPlainCake.TabIndex = 7;

this.lblPlainCake.Text = "Plain";

this.lblPlainCake.TextAlign =
System.Drawing.ContentAlignment.MiddleLeft;

//

// lblChocolateCake

//

this.lblChocolateCake.Location = new System.Drawing.Point(160,
112);

this.lblChocolateCake.Name = "lblChocolateCake";

this.lblChocolateCake.TabIndex = 8;

this.lblChocolateCake.Text = "Chocolate";

this.lblChocolateCake.TextAlign =
System.Drawing.ContentAlignment.MiddleLeft;

//

// lblSugarCake

//

this.lblSugarCake.Location = new System.Drawing.Point(160, 144);

this.lblSugarCake.Name = "lblSugarCake";

this.lblSugarCake.TabIndex = 9;

this.lblSugarCake.Text = "Sugar";

this.lblSugarCake.TextAlign =
System.Drawing.ContentAlignment.MiddleLeft;

//

// lblLemonFilled

//

this.lblLemonFilled.Location = new System.Drawing.Point(312, 80);

this.lblLemonFilled.Name = "lblLemonFilled";

this.lblLemonFilled.TabIndex = 10;

this.lblLemonFilled.Text = "Lemon";

this.lblLemonFilled.TextAlign =
System.Drawing.ContentAlignment.MiddleLeft;

//

// lblGrapeFilled

//

this.lblGrapeFilled.Location = new System.Drawing.Point(312, 112);

this.lblGrapeFilled.Name = "lblGrapeFilled";

this.lblGrapeFilled.TabIndex = 11;

this.lblGrapeFilled.Text = "Grape";

this.lblGrapeFilled.TextAlign =
System.Drawing.ContentAlignment.MiddleLeft;

//

// lblCustardFilled

//

this.lblCustardFilled.Location = new System.Drawing.Point(312,
144);

this.lblCustardFilled.Name = "lblCustardFilled";

this.lblCustardFilled.TabIndex = 12;

this.lblCustardFilled.Text = "Custard";

this.lblCustardFilled.TextAlign =
System.Drawing.ContentAlignment.MiddleLeft;

//

// txtGlazedRaised

//

this.txtGlazedRaised.BackColor =
System.Drawing.SystemColors.Window;

this.txtGlazedRaised.Location = new System.Drawing.Point(120, 80);

this.txtGlazedRaised.Name = "txtGlazedRaised";

this.txtGlazedRaised.ReadOnly = true;

this.txtGlazedRaised.Size = new System.Drawing.Size(24, 21);

this.txtGlazedRaised.TabIndex = 13;

this.txtGlazedRaised.Text = "";

//

// txtSugarRaised

//

this.txtSugarRaised.BackColor =
System.Drawing.SystemColors.Window;

this.txtSugarRaised.Location = new System.Drawing.Point(120, 112);

this.txtSugarRaised.Name = "txtSugarRaised";

this.txtSugarRaised.ReadOnly = true;

this.txtSugarRaised.Size = new System.Drawing.Size(24, 21);

this.txtSugarRaised.TabIndex = 14;

this.txtSugarRaised.Text = "";

//

// txtChocolateRaised

//

this.txtChocolateRaised.BackColor =
System.Drawing.SystemColors.Window;

this.txtChocolateRaised.Location = new System.Drawing.Point(120,
144);

this.txtChocolateRaised.Name = "txtChocolateRaised";

this.txtChocolateRaised.ReadOnly = true;

this.txtChocolateRaised.Size = new System.Drawing.Size(24, 21);

this.txtChocolateRaised.TabIndex = 15;

this.txtChocolateRaised.Text = "";

//

// txtPlainCake

//

this.txtPlainCake.BackColor = System.Drawing.SystemColors.Window;

this.txtPlainCake.Location = new System.Drawing.Point(264, 80);

this.txtPlainCake.Name = "txtPlainCake";

this.txtPlainCake.ReadOnly = true;

this.txtPlainCake.Size = new System.Drawing.Size(24, 21);

this.txtPlainCake.TabIndex = 16;

this.txtPlainCake.Text = "";

//

// txtChocolateCake

//

this.txtChocolateCake.BackColor =
System.Drawing.SystemColors.Window;

this.txtChocolateCake.Location = new System.Drawing.Point(264,
112);

this.txtChocolateCake.Name = "txtChocolateCake";

this.txtChocolateCake.ReadOnly = true;

this.txtChocolateCake.Size = new System.Drawing.Size(24, 21);

this.txtChocolateCake.TabIndex = 17;

this.txtChocolateCake.Text = "";

//

// txtSugarCake

//

this.txtSugarCake.BackColor = System.Drawing.SystemColors.Window;

this.txtSugarCake.Location = new System.Drawing.Point(264, 144);

this.txtSugarCake.Name = "txtSugarCake";

this.txtSugarCake.ReadOnly = true;

this.txtSugarCake.Size = new System.Drawing.Size(24, 21);

this.txtSugarCake.TabIndex = 18;

this.txtSugarCake.Text = "";

//

// txtLemonFilled

//

this.txtLemonFilled.BackColor =
System.Drawing.SystemColors.Window;

this.txtLemonFilled.Location = new System.Drawing.Point(416, 80);

this.txtLemonFilled.Name = "txtLemonFilled";

this.txtLemonFilled.ReadOnly = true;

this.txtLemonFilled.Size = new System.Drawing.Size(24, 21);

this.txtLemonFilled.TabIndex = 19;

this.txtLemonFilled.Text = "";

//

// txtGrapeFilled

//

this.txtGrapeFilled.BackColor =
System.Drawing.SystemColors.Window;

this.txtGrapeFilled.Location = new System.Drawing.Point(416, 112);

this.txtGrapeFilled.Name = "txtGrapeFilled";

this.txtGrapeFilled.ReadOnly = true;

this.txtGrapeFilled.Size = new System.Drawing.Size(24, 21);

this.txtGrapeFilled.TabIndex = 20;

this.txtGrapeFilled.Text = "";

//

// txtCustardFilled

//

this.txtCustardFilled.BackColor =
System.Drawing.SystemColors.Window;

this.txtCustardFilled.Location = new System.Drawing.Point(416,
144);

this.txtCustardFilled.Name = "txtCustardFilled";

this.txtCustardFilled.ReadOnly = true;

this.txtCustardFilled.Size = new System.Drawing.Size(24, 21);

this.txtCustardFilled.TabIndex = 21;

this.txtCustardFilled.Text = "";

//

// lblCurrentSale

//

this.lblCurrentSale.Location = new System.Drawing.Point(16, 176);

this.lblCurrentSale.Name = "lblCurrentSale";

this.lblCurrentSale.TabIndex = 22;

this.lblCurrentSale.Text = "Current Sales";

this.lblCurrentSale.TextAlign =
System.Drawing.ContentAlignment.MiddleLeft;

//

// lblQuantitylblQuantity

//

this.lblQuantitylblQuantity.Location = new
System.Drawing.Point(16, 208);

this.lblQuantitylblQuantity.Name = "lblQuantitylblQuantity";

this.lblQuantitylblQuantity.TabIndex = 23;

this.lblQuantitylblQuantity.Text = "Quantity";

this.lblQuantitylblQuantity.TextAlign =
System.Drawing.ContentAlignment.MiddleLeft;

//

// lblType

//

this.lblType.Location = new System.Drawing.Point(136, 208);

this.lblType.Name = "lblType";

this.lblType.TabIndex = 24;

this.lblType.Text = "Type";

this.lblType.TextAlign =
System.Drawing.ContentAlignment.MiddleLeft;

//

// lblPrice

//

this.lblPrice.Location = new System.Drawing.Point(248, 208);

this.lblPrice.Name = "lblPrice";

this.lblPrice.TabIndex = 25;

this.lblPrice.Text = "Price";

this.lblPrice.TextAlign =
System.Drawing.ContentAlignment.MiddleLeft;

//

// lblTotal

//

this.lblTotal.Location = new System.Drawing.Point(144, 336);

this.lblTotal.Name = "lblTotal";

this.lblTotal.TabIndex = 26;

this.lblTotal.Text = "Total";

this.lblTotal.TextAlign =
System.Drawing.ContentAlignment.MiddleLeft;

//

// txtQuantity

//

this.txtQuantity.Location = new System.Drawing.Point(16, 232);

this.txtQuantity.Name = "txtQuantity";

this.txtQuantity.TabIndex = 27;

this.txtQuantity.Text = "";

this.txtQuantity.KeyPress += new
System.Windows.Forms.KeyPressEventHandler(this.txt Quantity_KeyPress);

this.txtQuantity.Validating += new
System.ComponentModel.CancelEventHandler(this.txtQ uantity_Validating);

//

// cmbType

//

this.cmbType.Items.AddRange(new object[] {

"Raised-Glazed",

"Raised-Sugar",

"Raised-Chocolate",

"Cake-Plain",

"Cake-Chocolate",

"Cake-Sugar",

"Filled-Lemon",

"Filled-Grape",

"Filled-Custard"});

this.cmbType.Location = new System.Drawing.Point(136, 232);

this.cmbType.Name = "cmbType";

this.cmbType.Size = new System.Drawing.Size(104, 21);

this.cmbType.TabIndex = 28;

//

// txtPrice

//

this.txtPrice.Location = new System.Drawing.Point(256, 232);

this.txtPrice.Name = "txtPrice";

this.txtPrice.ReadOnly = true;

this.txtPrice.TabIndex = 29;

this.txtPrice.Text = "";

//

// lstSale

//

this.lstSale.Location = new System.Drawing.Point(16, 264);

this.lstSale.Name = "lstSale";

this.lstSale.Size = new System.Drawing.Size(344, 56);

this.lstSale.TabIndex = 30;

//

// btnAddToSale

//

this.btnAddToSale.Location = new System.Drawing.Point(376, 232);

this.btnAddToSale.Name = "btnAddToSale";

this.btnAddToSale.Size = new System.Drawing.Size(80, 23);

this.btnAddToSale.TabIndex = 31;

this.btnAddToSale.Text = "Add to Sale";

//

// btnRemoveItem

//

this.btnRemoveItem.Location = new System.Drawing.Point(376, 264);

this.btnRemoveItem.Name = "btnRemoveItem";

this.btnRemoveItem.Size = new System.Drawing.Size(80, 23);

this.btnRemoveItem.TabIndex = 32;

this.btnRemoveItem.Text = "Remove Item";

//

// btnCheckOut

//

this.btnCheckOut.Location = new System.Drawing.Point(376, 336);

this.btnCheckOut.Name = "btnCheckOut";

this.btnCheckOut.Size = new System.Drawing.Size(80, 23);

this.btnCheckOut.TabIndex = 33;

this.btnCheckOut.Text = "Check Out";

//

// txtTotal

//

this.txtTotal.Location = new System.Drawing.Point(256, 336);

this.txtTotal.Name = "txtTotal";

this.txtTotal.ReadOnly = true;

this.txtTotal.TabIndex = 34;

this.txtTotal.Text = "";

//

// errorProvider1

//

this.errorProvider1.ContainerControl = this;

//

// frmMain

//

this.AutoScaleBaseSize = new System.Drawing.Size(5, 14);

this.BackColor = System.Drawing.SystemColors.Menu;

this.ClientSize = new System.Drawing.Size(472, 373);

this.Font = new System.Drawing.Font("Tahoma", 8.25F,
System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point,
((System.Byte)(0)));

this.Controls.Add(this.txtTotal);

this.Controls.Add(this.btnCheckOut);

this.Controls.Add(this.btnRemoveItem);

this.Controls.Add(this.btnAddToSale);

this.Controls.Add(this.lstSale);

this.Controls.Add(this.txtPrice);

this.Controls.Add(this.cmbType);

this.Controls.Add(this.txtQuantity);

this.Controls.Add(this.lblTotal);

this.Controls.Add(this.lblPrice);

this.Controls.Add(this.lblType);

this.Controls.Add(this.lblQuantitylblQuantity);

this.Controls.Add(this.lblCurrentSale);

this.Controls.Add(this.txtCustardFilled);

this.Controls.Add(this.txtGrapeFilled);

this.Controls.Add(this.txtLemonFilled);

this.Controls.Add(this.txtSugarCake);

this.Controls.Add(this.txtChocolateCake);

this.Controls.Add(this.txtPlainCake);

this.Controls.Add(this.txtChocolateRaised);

this.Controls.Add(this.txtSugarRaised);

this.Controls.Add(this.txtGlazedRaised);

this.Controls.Add(this.lblCustardFilled);

this.Controls.Add(this.lblGrapeFilled);

this.Controls.Add(this.lblLemonFilled);

this.Controls.Add(this.lblSugarCake);

this.Controls.Add(this.lblChocolateCake);

this.Controls.Add(this.lblPlainCake);

this.Controls.Add(this.lblChocolateRaised);

this.Controls.Add(this.lblSugarRaised);

this.Controls.Add(this.lblGlazedRaised);

this.Controls.Add(this.lblFilled);

this.Controls.Add(this.lblCake);

this.Controls.Add(this.lblRaised);

this.Controls.Add(this.lblTitle);

this.Name = "frmMain";

this.Text = "Joe\'s Doughnut Factory";

this.ResumeLayout(false);

}

#endregion

/// <summary>

/// The main entry point for the application.

/// </summary>

[STAThread]

static void Main()

{

Application.Run(new frmMain());

}

private void mnuExit_Click(object sender, System.EventArgs e)

{

this.Close();

}

private void txtQuantity_Validating(object sender,
System.ComponentModel.CancelEventArgs e)

{

// Test that txtQuantity is not empty

if (txtQuantity.Text == "")

{

errorProvider1.SetError(txtQuantity,"Please enter a
quantity");

e.Cancel = true;

}

//Tests that there are no other errors in txtQuantity

else if ( errorProvider1.GetError(txtQuantity) != "")

e.Cancel = true;

else

errorProvider1.SetError(txtQuantity,"");

}

private void txtQuantity_KeyPress(object sender,
System.Windows.Forms.KeyPressEventArgs e)

{

if (char.IsDigit(e.KeyChar)== false)

errorProvider1.SetError(txtQuantity,"Please enter a numeric
value.");

else

errorProvider1.SetError(txtQuantity,"");

}

}

}

Nov 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Sandy | last post: by
4 posts views Thread by Tony Vitonis | last post: by
3 posts views Thread by Elena | last post: by
3 posts views Thread by Nathan | last post: by
16 posts views Thread by Geoff Jones | last post: by
4 posts views Thread by N00b13 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.