0% found this document useful (0 votes)
2K views

Account Registration: Laboratory Exercise

This document provides instructions for a laboratory exercise to practice using delegates and events in a C# Windows Forms application. Students will create classes to store student information and use delegates to pass data between forms to display a registration form, confirm the registration, and reset the form upon confirmation. The exercise involves declaring and initializing delegates, passing data between forms using delegates, validating user input, and handling form closing and submission events.

Uploaded by

Ruq Baldemor
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2K views

Account Registration: Laboratory Exercise

This document provides instructions for a laboratory exercise to practice using delegates and events in a C# Windows Forms application. Students will create classes to store student information and use delegates to pass data between forms to display a registration form, confirm the registration, and reset the form upon confirmation. The exercise involves declaring and initializing delegates, passing data between forms using delegates, validating user input, and handling form closing and submission events.

Uploaded by

Ruq Baldemor
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

IT1811

Laboratory Exercise
Account Registration
Objectives:

At the end of the exercise, the students should be able to:

 Declare, instantiate, and invoke delegates;


 Use generic delegate data types in a program; and
 Declare events and use event accessors.

Software Requirement:

 Visual Studio Community 2015 or higher

Procedures:

Instructions:
1. Create a Windows application for a simple student account registration. Name the project as Account
Registration and the form as FrmRegistration.
2. Follow the design for the FrmRegistration as seen in Figure 1.

Figure 1. FrmRegistration

3. Create a class named StudentInfoClass and initialize the two (2) delegates based on the table below.
The access modifier for each delegate should be public.
Delegate (Data Type) Variable Name Parameter-Variable
long DelegateNumber long number
string DelegateText string txt
4. Inside the class named StudentInfoClass initialize eight (8) static variables based on the table below.
Data Type Variable Name Value
FirstName " "
LastName " "
string MiddleName " "
Address " "
Program " "

01 Laboratory Exercise 1 *Property of STI


Page 1 of 3
IT1811

Data Type Variable Name Value


Age 0
long ContactNo 0
StudentNo 0
5. Create a static return type method based on the table below.
Method Name Parameter-Variable
GetFirstName string FirstName
GetLastName string LastName
GetMiddleName string MiddleName
GetAddress string Address
GetProgram string Program
GetAge long Age
GetContactNo long ContactNo
GetStudentNo long StudentNo

6. In the FrmRegistration, double click the Next button to generate an event click.
7. Call the static strings and long data type. Then, get the value of each TextBox and ComboBox. See
sample code below:
StudentInfoClass.Program = cbProgram.Text.ToString();
8. Create another form named FrmConfirm, Follow the design as seen in Figure 2.

Figure 2. FrmConfirm
9. View the code in FrmConfirm, set the variables for each delegate. See the code below.
private DelegateText DelProgram, DelLastName, DelFirstName, DelMiddleName,
DelAddress;
private DelegateNumber DelNumAge, DelNumContactNo, DelStudNo;
10. Initialize all the delegates inside the constructor and call each static method. See the sample code
below:
public FrmConfirm(){
InitializeComponent();
DelProgram = new DelegateText(StudentInfoClass.GetProgram);
}

01 Laboratory Exercise 1 *Property of STI


Page 2 of 3
IT1811

Challenge Exercise:
11. In the FrmRegistration, call the FrmConfirm using the ShowDialog() method.
12. Write a code that validates if the FrmConfirm ShowDialog() is equal to DialogResult.OK. All the
Textbox and ComboBox controls will reset.
13. Inside the FrmConfirm, display all the inputs in each label in the Forms Load event.
LabelName.Text = DelProgram(StudentInfoClass.Program);
14. Double click the Confirm button to create an event click. Add the following code:
this.DialogResult = DialogResult.OK;
this.Close();
15. Go back to the frmConfirm's design and look for the FormClosing event. Double click and add the
following code:
this.DialogResult = DialogResult.OK;
16. Run the program to check the output.
17. Inform your instructor once you’re done as this will be recorded.

Grading Rubric:
CRITERIA PERFORMANCE INDICATORS POINTS
Correctness The code produces the expected result. 30
Logic The code meets the specifications of the problem. 30
Efficiency The code is concise without sacrificing correctness and logic. 20
Syntax The code adheres to the rules of the programming language. 20
TOTAL 100

01 Laboratory Exercise 1 *Property of STI


Page 3 of 3

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy