C Use two new controls ComboBox and ListBox as well as separ

C#

Use two new controls; ComboBox and ListBox, as well as separate About form.

Create a project for local coffee shop.

Your design should consist of three frame controls:

The first frame control that has Command Buttons of: Add Coffee Flavor, Remove Coffee Flavor, Clear Coffee List, and Count Coffee List. As an alternative you may have menu for these options (better alternative).

The second frame control that has a ComboBox, for selecting coffee flavors such as (Espresso, Latte, Cappuccino, Mocha, Americana), and a ListBox that has the list of Syrup flavors such as (Almond, Amaretto, Caramel, Chocolate Milano, Cinnamon).

The third frame control has Exit, Clear and About commands.

NOTE: You can move the contents of first and third frame controls to a MenuStrip for better readability.

Activities:

In case of Add Coffee Flavor, the desired coffee flavor must be typed in a textbox. Program checks the list and notifies the user if that flavor is already in the list. Also, do not allow a blank coffee name to be added to the list.

In case of Count Coffee List, the message box lists the number of coffee flavors in the list.

Before clearing the list, display a message box to confirm the operation. Also, the user must be notified that the list is cleared.

Display error message if the user selects Remove without first selecting the name.

The program should also create and initialize two arrays, one to keep prices for coffee flavors, and one for syrup flavors (Provide your own data). When the user selects a coffee flavor and/or syrup flavor display information about item(s) selected and their prices.

There will be separate About form named Help that has the name of programmer along with subject of the program.

Solution

Code For 1sy form:
using System;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public void AddMenu()
{  
   MainMenu mnuFileMenu = new MainMenu();
   this.Menu = mnuFileMenu;
}
public void AddMenuAndItems()
{
    MainMenu mnuFileMenu = new MainMenu();
   this.Menu = mnuFileMenu;
}
MenuItem myMenuItemFile = new MenuItem(\"Add Coffie Flaver\");
MenuItem myMenuItemNew = new MenuItem(\"Remove Coffie Flaver\");
MenuItem myMenuItemFile = new MenuItem(\"Clear coffie List\");
MenuItem myMenuItemNew = new MenuItem(\"Count Coffie List\");

mnuFileMenu.MenuItems.Add(myMenuItemFile);
myMenuItemFile.MenuItems.Add(myMenuItemNew);
}

Code for 2nd Form:
using System;
using System.Drawing;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
   comboBox1.Items.Add(\"Espresso\");
comboBox1.Items.Add(\"Latte\");
   comboBox1.Items.Add(\"Cappuccino\");
comboBox1.Items.Add(\"Mocha\");
comboBox1.Items.Add(\"Americana\");
listBox1.Items.Add(\"Almond\");
listBox1.Items.Add(\"Amaretoo\");
listBox1.Items.Add(\"Caramal\");
listBox1.Items.Add(\"chocolate Milano\");
listBox1.Items.Add(\"Cinnamon\");
listBox1.SelectionMode = SelectionMode.MultiSimple;
}
private void button1_Click(object sender, EventArgs e)
{
foreach (Object obj in listBox1.SelectedItems )
   }
    Private void button1_Click(object sender, EventArgs e)
   {
       foreach (Object obj in comboBox1.SelectedItems )
    }
  
MessageBox.Show(obj.ToString ());
}
}
}
}
Code for 3rd Form:
Private void exit_click(object sender,Eventargs e)
{
   This.close();
}
Private void clr_click(object sender,Eventargs e)
{
   This.clrer();
}

C# Use two new controls; ComboBox and ListBox, as well as separate About form. Create a project for local coffee shop. Your design should consist of three frame
C# Use two new controls; ComboBox and ListBox, as well as separate About form. Create a project for local coffee shop. Your design should consist of three frame

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site