Question: gui app In Form 1 ( MISY 2 3 1 3 Project ) - Change the title to ( MISY 2 3 1 3 -

gui app In Form1(MISY 2313 Project)
- Change the title to (MISY2313-Project) and select appropriate icon.
- Add PMU picture in a picture box control that covers most of the form except a narrow strip at the top.
- Add MenuStrip control to the form.
- Define a menu for the following items (File, Sale, Team, and Instructions), where File has a submenu of (New, Open, and Select) and Team has a submenu for the members of the group.
- Add OpenFileDialog control.
- File New is used to create new text file, Open is used to view and modify an existing file, and select is to select existing file to be used in Form3.
- Following is a possible sample of Form1
Create Form2(Manipulate Items)
- Make its title as (Manipulate Items)
- Add a big scrollable multi-line textbox control.
- Add OpenFileDialog and SaveFileDialog controls.
- Add Save File button control.
- Following is a possible sample of Form2
Create Form3(Process Sale)
- Make its title as (Process Sale)
- This form contains a label and textbox to enter an item ID, another label and textbox to enter the quantity, a button to enter the Item details, a simple multiline textbox with labels or dataGridView control for better formatting, and lables to display the grand total.
- Form3 also uses a combo box to display the names of several Saudi cities. Set the names of the cities in a combobox in the design mode. When the user selects a city from the combox, the city map is displayed. To give you a startup, I will guide you through the important steps of development.
Programming Form1 controls
- Double click on File>>New submenu. Program it to create object for Form2 and show it.
- Program File>>Open to create Form2 object, show its OpenFileDialog, read the contents of the selected file and display it in the textbox of Form2, then show form2. Be sure that both openFileDialog and textbox of Form2 modifiers set to Public to be able to access them from Form1. The code needed her is:
Form2 f2= new Form2();
f2.openFileDialog1.ShowDialog();
string content = File.ReadAllText(f2.openFileDialog1.FileName);
f2.txtFileContents.Text = content;
f2.Show();
- Program File>>Select to show its fileDialog. Store the file name selected in a global String variable (I called it ItemsFile and initialized it to ). You make it global to be able to use it later from another method. Create Form3 object and populate the selected name file in a hidden labels (named as lblFileUsed).
- Program Sale menu using the following code:
Form3 f3= new Form3();
f3.lblFileUsed.Text = ItemsFile;
if (f3.lblFileUsed.Text !="")
f3.Show();
else
MessageBox.Show("Please select a file through File>select");
- Instructions menu item will simply show a message telling you how to use the application. However, you can create another form for the purpose if you wish.
Programming Form2 controls
Form2 has only one button to program. To help you in this, following is the code needed:
var saveFileDialog1= new SaveFileDialog
{
InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal),
Filter = string.Format("{0}Text files (*.txt)|*.txt|All files (*.*)|*.*", "ARG0"),
RestoreDirectory = true,
ShowHelp = true,
CheckFileExists = false
};
if (saveFileDialog1.ShowDialog()== DialogResult.OK)
File.WriteAllText(saveFileDialog1.FileName, txtFileContents.Text);
this.Close();
Programming Form3 controls
1- Declare a global parallel arrays for (itemId:string, description:string, price:double). Set their sizes to a value higher than the possible number of items. I used 20.
2- Load the text file found in lblFileUsed (selected through select submenu in Form1) into the arrays when the form is loaded. Split the text by comas as in the following:
111,Cola,1.5
222,Marker,4.5
333,Glasses,260
444,Mouse,25.99
555,Keyboard,15
-----
-----
Load the arrays with the values found in the selected file. See the following code:
try {
TextReader tr = File.OpenText("d:...\Items.txt");
string strLine = string.Empty; //or use =;
string[] arrColumns = null;
while ((strLine = tr.ReadLine())!= null)
{
arrColumns = strLine.Split(',');//coma delimited
itemId[count]= arrColumns[0];
description[count]= arrColumns[1];
price [count++]=.....
}
tr.Close();
}
catch
{
MessageBox.Show("Cannot open the file");
}
The above code should triggered from the form load method.
3- Program the Enter Item button to add a line based on the entered itemId and the quantity. Subtotals and grand total are calculated.
4- Program the cboCities (contains few Saudi cities entered during the design phase) to display the map of the selected city. Make cboCities Text property showing Select a City..
Use a code similar to the followi

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!