Download as pdf
Download as pdf
You are on page 1of 16
OBJECT ORIENTED PROGRAMMING, LABORATORY EXERCISES: EXERCISE NO. 9 OBJECTIVE: Creation of multiole forms DIRECTIONS: Construct the form found in the sample dialogue and implement the given instructions below: 1. Create a new project (Windows Application). Save the project as pe#_act9, example: pc12_act9. 2. Insert all the necessary components to complete the given form below. You may use RadioButton instead of CheckBox to get rid of additional codes. 3 Grocery ng Bayan GROCERY NI GLORIA Dicedado Macapagal Expressway eet [lack Movtan tect [Tusogaao Gay Tes Puchase [P0000 Nenbostix |) SercrGtzen [] Stent] None CO Kebayancard C] Wa veteran Dicerted ice | TerdeedAnaunt: (5000 {! 3. The inputs in the given form are the following: name, address, total purchase, membership and tendered amount. Each membership type are given the following discount Senior Citizen 10% of total purchase Kabayan Card 8% of total purchase Student 5% of total purchase ‘War Veteran 6% of total purchase 4. Inorder to display the discounted price of a customer, the user should press the Discount bution. After pressing the button, another form should appear like the given interface below: Discount 5. The computed discount appears automatically. When the user press the OK button, the form closes and the Discounted Price textbox is filled with the same value. 6. Display also the change if there is any. MR. EDMUND D. EVANGEL! TA, University of Saint Loui Page 1 OBJECT ORIENTED PROGRAMMING, LABORATORY EXERCISES: 7. When the user press the Print button, just display the message “No printer installed. Service not available!”. 8 Be sure to display an error message when the user enters a Tendered Amount less than the total purchase. one GROCERY NI GLORIA Diosdado Macapagal Expressway lack Manatan Tupueyatao Cy Total Purchase: [Ps000.00 Members © Seri Cie ] Student) None DD Kebayen Cad C) WerVeteten psn so00 Poa cd (itseore | (tex) (pe Cee) MR. EDMUND D. EVANGEL! TA, University of Saint Loui Page 2 OBJECT ORIENTED PROGRAMMING, LABORATORY EXERCISES: EXERCISE NO. 10 OBJECTIVE: Create a user security form DIRECTIONS: Create a user security form that requires user authentication. Construct the form found in the sample dialogue and implement the given instructions below: 1. Create a new project (Windows Application). Save the project as pe#_act10, example: pe12_act10. 2, Insert all the necessary components to complete the given form below. oa) Usememe: || 3. Click the username textbox and set the Name as txtUsername. 4. Click the password textbox and set the Name as txtPassword. Set also the PasswordChar property to asterisk (*) Fe EL Vor MEP Bs Deby Du Tods Wrdor Cnmuey la ise texan a 5. Double click the form and insert only the highlighted code inside the box. Be sure to indicate it in the specified part of the program (above the constructor. MR. EDMUND D. EVANGEL! "TA, University of Saint L Page 1 OBJECT ORIENTED PROGRAMM! ING, LABORATORY. namespace Security For public partial lass Form : Form { String user 'SICS', pass = "myadmin’, _|//NOTE: instance variables public Forr1() _/INOTE: constructor { InifatizeComponent) } private void Fort _Load{object sender, EventArgs e) { 4 } } 6. Double click the Login button and insert only the highlighted codes below: private void blnLogin_Click(object sender, EventArgs e) t if ((xtUsemame Text) == user && (txtPassword, Tex!) == pass) ‘txtUsemame.Clear(), txtPassword Clear); MessageBox Show(‘Access Granted") } else MessageBox Show("Access Denied!) } 7. Double click the Cancel button and insert the given codes below: ‘txtUsername.Clear(); ‘tutPassword.Clear(); 8, Double click the Exit button and insert the given codes below: Application Exit); 9, Test your application. fa ac) Username: [sid Password, [omen (Cee) Comes a MR. EDMUND D. EVANGELISTA, University of Page 2 OBJECT ORIENTED PROGRAMMING, LABORATORY EXERCISES: EXERCISE NO. 11 OBJECTIVE: Create a user security form DIRECTIONS: Create an application to facilitate the vehicle registration in Land Transportation Office. Construct the form found in the sample dialogue and implement the given instructions below. 1. Create a new project (Windows Application). Save the project as pe#_act1, example: pe12_act11. 2. Insert all the necessary components to complete the given form below. eee LAND TRANSPORTATION OFFICE Regional Otfice 2 (Main Office) Tuguegarao Gity Om — © Seeder © Utily Osecp OB Teale © Tiexcle © Dunptack © Others Wit preveus ofieres: C]'Yer No Armour to be pit (come) (cox) Cee J Ce) 3, The computation of the amount to be paid are as follows: Car P5000 Scooter P1800 Utility P1s600 Jeep P6000 Bus P8700 Trailer 17400 Tricycle P3200 Dumptrack P10000 Others ~to be negotiated — 4, If atany rate the applicant has a previous offense/arrear, there is an additional of P500 to be paid. 5. Create another form and name it as SeeurityForm. Create the given interface below. See ed Password 6. Set the textbox username as txtUsername and password as password. 7. Double click the form and insert the codes found inside the box. MR. EDMUND D. EVANGEL! TA, University of Saint Loui Page 1 OBJECT ORIENTED PROGRAMMING, LABORATORY EXERCISES: Susing system, wanaows.rorms: namespace Car_Registration ‘ | public partial class SecurityForm : Form public int indicator = 07 String user = "SICS", pass ~ "myndmin"; E public SecurityForm() « InitdalizeComponent () ; > 8, Double click the Login button and insert the given codes. if ((txtUsernane. Text) ‘ user €& (txtPassuord.Text) == pass) rxtUsername.Clear()+ rxtPassvord.Clear(); indicator = 1; chis.Close() + ) else MessageBox .Show("Access Denied!) : 9. Go back to your main form (Form1.cs). Double click the form and insert the codes found: inside the box. [namespace Car_Registration 4" public partial class Formi : Form ‘ public Form () ‘ InitializeComponent (); ~ private void Forml_Load(object sender, Eventirgs e) ‘ SecurityForm sf = nev SecurityForm(); sf.ShowDialog(); if (sf.indicator == 0) this.Close(}7 ? 10. Double click the Save bution and insert the given code: MessageBox.Show("Sorry, the database is not yet availabl MR. EDMUND D. EVANGEL! TA, University of § Page 2 OBJECT ORIENTED PROGRAMMING, LABORATORY EXERCISES: 11. Complete the other codes of the program. 42. Run your application Vinee Une Usemame: [Sics_ Password LAND TRANSPORTATION OFFICE Regional Office 2 (Main Office) Tuguegarao City FubNare: [Jack Manatan Addess: —|[Petagnieg Cry 998 Number: [17423607 voice time: [Oca O Seater O Uiily O deep © Bus O Teer (© Tizycle © Dumptack © Other With preveus fires: [2] Yer No Aivourtto be ped 0500.00 (icone) (c= _) Caee J) MR. EDMUND D. EVANGEL! TA, University of Saint Loui Page 3 OBJECT ORIENTED PROGRAMMING, LABORATORY EXERCISES: EXERCISE NO. 12 OBJECTIVE: ‘+ Designing splash screen using ProgressBar © Designing Menu DIRECTIONS: Create an application that includes a splash screen using progress bar. Construct the form found in the sample dialogue and implement the given instructions below. 1. Create a new project (Windows Application). Save the project as pe#_act12, example: pe12_act12. 2. Insert all the necessary components to complete the given form below. Set also the tollowing properties of the form: Pee Size: 502, 423 Backgroundimage: theophile.jpg BackgroundimageLayout: Stretch 3. Select the toolbox and insert a MenuStrip into your form and type &Application as part of the Main Menu, MR. EDMUND D. EVANGEL! "TA, University of Saint L Page 1 OBJECT ORIENTED PROGRAMMING, LABORATORY EXERCISES: 4, Type the following sub-menu under Application. Take note, we will not yet insert any code for every sub-menu. This will be completed later. If you intend to insert a code in a sub-menu, double click it and tyoe your codes. Insert two additional Menu: &Developer and & About. Insert another form and name it as MySplash. Select Toolbox and insert a ProgressBar into your form. ‘Complete the addtional components of the form. MySplash.cs [Design] | Force (Ceson]™ Iniang CT Size: 400, 117 Name (Label): IbiDisplay Name (Progress Bar): ProgressBart Additional: Set the required property values of the splash form such as disabling the control box and tile of the form 10. Insert a Timer. Set the Enabled property as True. Double click it and insert the following code: if (ProgressBar! Value < 100) IblData.Text = "intalizing.” + Convert-ToStinalProgressBar1 Value) + "%", ProgressBar! Value = ProgressBari Value + 1 } else. timer! Enabled = false; 11. Insert another timer in your splash form. Set the following properties: Enabled True Interval 10000 12. Double click the second timer and type this.Close();. 12. Select Program.cs and incort the given code above Application. Run(...): MR. EDMUND D. EVANGEL! "TA, University of Saint L Page 2 OBJECT ORIENTED PROGRAMMING, LABORATORY EXERCISES: MyspLash ms = new Mysplash(); mg. SnowDisleg (Ii 14, Run your application MR. EDMUND D. EVANGEL! TA, University of § Page 3 OBJECT ORIENTED PROGRAMMING, LABORATORY EXERCISES: EXERCISE NO. 13 OBJECTIVE: ‘+ Implementation of GridView and AboutBox DIRECTIONS: Create a new projact (Windows Application). Save the project as pet act13, example: c12_act1S. In this application, you are expected to create a GridView of an Access Database. 1. Create an additional form and save it as MySplash.cs. Create your own splash screen that Uses a progress bar. Be sure that this form will appear first without a tile and control box 2. Go back the main form (Form1.es) and create the following interface. Enero 3. Insert a code for the Exit menu such that when a user presses this menu, a message should appear frst “Are you sure you want to terminate the application?” When the user confirmed if, the application should terminate. 4. Copy the database inveice.mdb from the public folder and paste it your personal folder. 5. When a user pressed the About menu, a new form should appear In a modeless stale. In this form, simple information abou! you as a developer should appear 6. Insert a TabControl (found in the Toolbox ~ Cont: ihe title of each tab using the TabPages properly. \ers Category) in Formt.es and set © Comainers Pointer Fontayoutana © crow8oe Pee! TD seecontrer MR. EDMUND D. EVANGEL! "TA, University of Saint L Page 1 OBJECT ORIENTED PROGRAMMING, LABORATORY EXERCISES: Hoaoavsneracot 7. The first tab should have a name Customer while the second tab should have a name Products. 8. Select the first tab and inser a DataGridView init. peers adcered dean said 9. Select Choose Data Sourse | Add Project Data Source as shawn below. MR. EDMUND D. EVANGEL! Page 2 "TA, University of Saint L el aE 10, Select Database u =e =e Page 3 OBJECT ORIENTED PROGRAMMING, LABORATORY EXERCISES: 12, Selec! Microsoft Access Database File nies Desaiption Ure tie clacton to connect to 2 ‘Microsoft Accoss database fle using ‘the native Jo provider through the “NET Framenerk Data Provider For LED. [ NET Framework Data Provider for O Dlainays use this selection ree {leecher te choose salve daa source andor ever Dat gure Seer an sien —_ ie] ernane: (atin icc scones Logontotie database MR. EDMUND D. EVANGEL! Page 4 TA, University of § OBJECT ORIENTED PROGRAMMING, LABORATORY EXERCISES: 15. Select Yes when there Is a dialog asking you to create a copy of your database. 16. Save Ihe connection string by pressing Yes when there is a dialog requiting you lo save Ihe connection siting, 17. Select the Customer table. & ‘tose Your Database objects ic dass bes youve yar tat? 18. Press the + button to view the fields of the table. Select only the fields with check mark. Select Finish 19. Resize the fable as shown below. MR. EDMUND D. EVANGEL! "TA, University of Saint L Page 5 OBJECT ORIENTED PROGRAMMING, LABORATORY EXERCISES: scot in {ie00e00. 1280Herarde 20..Do the same instruction for the Products tab but the table involved in the gridview: should be thlProd. chol the 21. Run your application. The data stared in each fable should appear in ec jabs available in your forms. of Saint Loui Page 6

You might also like