0% found this document useful (0 votes)
5 views

C_LAB1

This document outlines a laboratory exercise for students to learn the basics of Microsoft Visual C# .NET. It includes objectives such as opening C#.Net, creating a new project, writing a simple program, and saving the project. The exercise guides students through starting the application, writing code, running the program, and exiting the software.

Uploaded by

ann.joaquin
Copyright
© © All Rights Reserved
0% found this document useful (0 votes)
5 views

C_LAB1

This document outlines a laboratory exercise for students to learn the basics of Microsoft Visual C# .NET. It includes objectives such as opening C#.Net, creating a new project, writing a simple program, and saving the project. The exercise guides students through starting the application, writing code, running the program, and exiting the software.

Uploaded by

ann.joaquin
Copyright
© © All Rights Reserved
You are on page 1/ 4

Laboratory Exercise 1

Introduction to Microsoft Visual C# .NET


Objectives:

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


 Open C#.Net
 Create a new project or a program
 Exit C# .Net

Materials:
 Flash drive
 PC with installed Microsoft Visual C# 2010 Express

Basic Principles:
With the use of Microsoft Visual C# 2010, you can develop a program of windows form
applications and web applications.

Procedures:

Activity 1 Starting Visual C# .Net


1. Click Start, point to All Programs, point to Microsoft Visual Studio 2010 Express and then
click
Microsoft Visual C# 2010 Express.

Figure 1.1 C# Start Page

Note: For the introduction of developing using C# programming language, we will


create a new project that will be discussed later. Click New Project to create a project.

C# Laboratory Exercise 1 Page 1 of 4


Figure 1.2 New Project

2. After clicking New Project., a new window will prompt. Select Windows Forms Application
then name your project as “CSharp Programming”. Press OK button.

Menus
Solution Explorer
Window

Toolbar
s

Code Window

Property Window
Figure 1.3 C#.NET IDE

Activity 2 Writing a simple program

1. Insert the following lines of code inside the Form1_Load Function:

private void Form1_Load(object sender, EventArgs e)


{
MessageBox.Show("Hello UCP- IT Students!");
}

C# Laboratory Exercise 1 Page 2 of 4


Activity 3 Running a simple program

1. Click the Start Debugging button on the toolbar. An output similar to the one shown
below will appear on your screen if you successfully run the program.

Figure 1.4 Running a program


NOTE: You must always check your codes before debugging or running your
program. If error occurs, click the Stop button to interrupt the program from
running, then check your codes and ensure that the provided code above is
entered correctly.

Activity 4 Saving a program

1. Click File menu then select Save All from the submenu. The Save Project dialog box
appears.

Figure 1.5 Saving a project

NOTE: C# .NET automatically creates a folder in My Documents which serves as


the default saving location of the projects. However, you can save your projects to
any location by clicking on the Browse button.

C# Laboratory Exercise 1 Page 3 of 4


2. Click Browse. The Project Location dialog box appears.

Figure 1.6 Saving a project

3. Locate your flash drive in the Look in box.


4. Click the Create New Folder button then name it LabExercise1 - [Surname]. Click
OK.
5. Select the created folder and then click Open.
TIP: If the folder you created is not displayed, click the Up One Level button
then select the folder and then click Open.

6. Click Save on the Save Project dialog box.

Exiting C#.Net

1. On File menu, click Exit or you can simply click the Close (X) button on the upper-right
corner of the application.

C# Laboratory Exercise 1 Page 4 of 4

You might also like