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

VP - Lab 2

The document provides instructions for a lab assignment on visual programming in Visual Studio 2015. The objectives are to explore the Visual Studio environment, create a Windows forms application, add and program controls like labels, textboxes and buttons, and handle events. Specific tasks include making a 'Hello World' application, adding accept and cancel buttons, and creating a login form with programmed buttons.

Uploaded by

Bisma Tasawar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

VP - Lab 2

The document provides instructions for a lab assignment on visual programming in Visual Studio 2015. The objectives are to explore the Visual Studio environment, create a Windows forms application, add and program controls like labels, textboxes and buttons, and handle events. Specific tasks include making a 'Hello World' application, adding accept and cancel buttons, and creating a login form with programmed buttons.

Uploaded by

Bisma Tasawar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

National University of Modern Languages

Department of Computer Sciences and Engineering

Visual Programming

Lab 2

Objectives

1. Exploring Visual Studio 2015 environment


2. Developing first Windows Form project
3. Using Textbox, Label and Button controls
4. Exploring different properties related to the controls
5. Event handling

Task 1: Exploring the environment

Open Visual Studio 2015 and explore different basic options to get a basic start.

Follow the instructor for this task.

Task 2: Creating a new project

Go to File > New > Project

Click Visual C# and select project type as “Windows Forms Application”.

Provide a suitable name and also select location if necessary. Click ”OK” to let Visual Studio
create your project.
Task 3: “Hello World” Project and using some Form properties

Drag and drop a label control on your form. Pick the label control from Toolbox.

Name the label as desired using Properties section of Visual Studio.

Double click the form to open the Load even of your form.

Set the text of your label as “Hello World”.

Click “Start” to observe the output.

Explore some Form properties (Name, Text, StartPosition, Icon, MaximizeBox, BackColor).

Task 4: Accept and Cancel Buttons for a form

Add two buttons on the form and change the text of the label on their click events.

Link the buttons with “AcceptButton” and “CancelButton” properties.


Task 5: Creating a login form

Add a new form to the existing project. Right click the project in “Solution Explorer” and use the
option Add > Windows Form.

Design the form as represented below. Do not forget to name your controls wherever needed.

Program “Login” and “Clear” button click events as below:

Link the buttons to “AcceptButton” and “CancelButton” as required.

Run the project to observe the output.


Pro Tips:

 Always name all controls in order to use them efficiently.


 Use String.Empty to clear texts/Strings.
 You can always change the Form to be displayed at the start of the project by changing
it in Program.cs > Application.Run().

You might also like