Question: gui app In Form 1 ( MISY 2 3 1 3 Project ) - Change the title to ( MISY 2 3 1 3 -
gui app In FormMISY Project
Change the title to MISYProject 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 Form
Following is a possible sample of Form
Create FormManipulate Items
Make its title as Manipulate Items
Add a big scrollable multiline textbox control.
Add OpenFileDialog and SaveFileDialog controls.
Add Save File button control.
Following is a possible sample of Form
Create FormProcess 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.
Form 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 Form controls
Double click on FileNew submenu. Program it to create object for Form and show it
Program FileOpen to create Form object, show its OpenFileDialog, read the contents of the selected file and display it in the textbox of Form then show form Be sure that both openFileDialog and textbox of Form modifiers set to Public to be able to access them from Form The code needed her is:
Form f new Form;
fopenFileDialogShowDialog;
string content File.ReadAllTextfopenFileDialogFileName;
ftxtFileContents.Text content;
fShow;
Program FileSelect 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 Form object and populate the selected name file in a hidden labels named as lblFileUsed
Program Sale menu using the following code:
Form f new Form;
flblFileUsed.Text ItemsFile;
if flblFileUsed.Text
fShow;
else
MessageBox.ShowPlease select a file through Fileselect";
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 Form controls
Form has only one button to program. To help you in this, following is the code needed:
var saveFileDialog new SaveFileDialog
InitialDirectory Environment.GetFolderPathEnvironmentSpecialFolder.Personal
Filter string.FormatText files txttxtAll files "ARG
RestoreDirectory true,
ShowHelp true,
CheckFileExists false
;
if saveFileDialogShowDialog DialogResult.OK
File.WriteAllTextsaveFileDialogFileName, txtFileContents.Text;
this.Close;
Programming Form controls
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
Load the text file found in lblFileUsed selected through select submenu in Form into the arrays when the form is loaded. Split the text by comas as in the following:
Cola,
Marker,
Glasses,
Mouse,
Keyboard,
Load the arrays with the values found in the selected file. See the following code:
try
TextReader tr File.OpenTextd:Itemstxt;
string strLine string.Empty; or use ;
string arrColumns null;
while strLine trReadLine null
arrColumns strLine.Split;coma delimited
itemIdcount arrColumns;
descriptioncount arrColumns;
price count
trClose;
catch
MessageBox.ShowCannot open the file";
The above code should triggered from the form load method.
Program the Enter Item button to add a line based on the entered itemId and the quantity. Subtotals and grand total are calculated.
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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
