Lab 1.1
Objectives: Saving, Compiling and Running a C# Program
You have been asked to create an application to display “Hello World” on the screen. Fo...
8 downloads
0 Views
Lab 1.1
Objectives: Saving, Compiling and Running a C# Program
You have been asked to create an application to display “Hello World” on the screen. Follow the steps to create the program:
STEP 1: Create a new Windows Forms Application in Visual Studio name “Lab 1.1”
STEP 2: Drag and drop a label from the tool box into the design view
STEP 3: Change to the text of the Label to “Hello World”
STEP 4: Compile your program and resolve any errors.
STEP 5: Run your program.
Lab 1.2
Objectives: Saving, Compiling and Running a C# Program Correcting Errors
You have been asked to create an application to display your full name, your class and your school name. Follow the steps to create the program:
STEP 1: Create a new Windows Forms Application in Visual Studio name “Lab 1.2”
STEP 2: Drag and drop 6 labels from the tool box into the design view
STEP 3: Rename the labels accordingly
STEP 4: Arrange the label into 3 rows.
STEP 5: Change the Title text bold with a font size of 12
STEP 6: Make the content text italic with a font size of 10
STEP 7: Align the labels properly
STEP 8: Compile your program and resolve any errors
STEP 9: Run your program
Lab 1.3
Objectives: Saving, Compiling and Running a C# Program Correcting Errors Adding Comments to a C# Program Running an event
You have been asked to create an application to display Hello World at a click of a button. You have been asked to modify your HelloWorld application so that it includes comments. Follow the steps to create the program:
STEP 1: Create a new Windows Forms Application in Visual Studio name “Lab 1.1”
STEP 2: Drag and drop a button from the tool box into the design view
STEP 3: Rename the text of the button to “Click Me!”
STEP 4: Rename the Name of the button to “btnClick”
STEP 5: Double click on the button to access code view
STEP 5: Add the code below with in the btnClick scope: MessageBox.Show("Hello World"); Eg: private void btnClick_Click(object sender, EventArgs e) { MessageBox.Show("Hello World"); }
STEP 5: Add the following comments below MessageBox.show(“Hello World”);
// The lines below will not run by the program
// Written by // Written on STEP 3: Add the following block comment after the previous lines
/* This button is used to display the message Hello World in a messagebox. */
STEP 4: Save the changes
STEP 5: Compile your program and resolve any errors
STEP 6: Run your program
Topic 1 - C# Introduction
TAFE NSW Information Technology Page 2 of 2