0% found this document useful (0 votes)
198 views16 pages

Visual Programming Lab Manual: Make Sure You Have Dotnet Framework 4.5 Is Installed You Can Download It From

The document provides instructions for installing Microsoft Visual Studio 2019 and setting up a C# programming environment. It outlines 7 steps for installing Visual Studio, including downloading prerequisites, installing the application, selecting workloads and components, and completing the installation process. It then describes 8 steps for creating a first C# console application, such as selecting a console app template, writing "Hello World" code, building and running the program. The document aims to familiarize students with Visual Studio and basic C# programming.

Uploaded by

Shahid Hussain
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)
198 views16 pages

Visual Programming Lab Manual: Make Sure You Have Dotnet Framework 4.5 Is Installed You Can Download It From

The document provides instructions for installing Microsoft Visual Studio 2019 and setting up a C# programming environment. It outlines 7 steps for installing Visual Studio, including downloading prerequisites, installing the application, selecting workloads and components, and completing the installation process. It then describes 8 steps for creating a first C# console application, such as selecting a console app template, writing "Hello World" code, building and running the program. The document aims to familiarize students with Visual Studio and basic C# programming.

Uploaded by

Shahid Hussain
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/ 16

VISUAL PROGRAMMING LAB MANUAL

LAB#1

OBJECTIVES:

Recall C# programming and familiarization with programming environment using MS


Visual studio IDE

THEORY:

C# is a simple, modern, general-purpose, object-oriented programming language


developed by Microsoft within its .NET initiative led by Anders Hejlsberg. This lab will
teach you basic C# programming and familiarize you with MS Visual Studio IDE.

To run a C# programs we need to install Microsoft Visual Studio IDE. The following
screenshots will guide you the installation steps of MS VS 2019, you just need to follow
the instructions on the screen. Other versions of MS Visual studio are also available,
therefore, students are encouraged to install and practice lab stuff on ms studio of their
choice.

Step 1: Installing the prerequisites


Before beginning installation, install the following prerequisites:
 Make sure you have dotnet framework 4.5 is installed You can download it from
the following https://www.microsoft.com/en-
in/download/details.aspx?id=30653

Step2: Download Visual Studio 2019

You can download it from https://visualstudio.microsoft.com/vs/preview/ Download


Visual studio 2019

Step3: Starting Installation of Visual Studio 2019


Right-click and select the Run as administrator on the downloaded file to begin the
installation

1
VISUAL PROGRAMMING LAB MANUAL

You will be asked for permission to continue. Click on Yes to continue with the
installation.

Step4: Software License Terms

Next, you will be asked to accept the software License terms and Privacy Statement.
Click on continue to go ahead with the installation.

Step5: Installer Downloads the required files

2
VISUAL PROGRAMMING LAB MANUAL

Step6: Choose what to install

The Installer will ask for the features you wish to install. You have four options here:
• Workloads
• Individual Components
• Language Packs
• Installation Location

 Select Workloads
The first option is to select workloads. A workload is a group of individual components
based on the project type. For Example, if you are developing using ASP.NET for web
development then you can choose ASP.NET and web development workload which will
install the following components for you:

 C# and Visual Basic


 .Net Framework 4.6
 ASP.NET and web development tools
 Entity Framework tools
 Typescript SDK
 IIS Express
 NuGet Package Manager

Select the required Workload. I have chosen .NET Desktop development & ASP.NET and
web development.

3
VISUAL PROGRAMMING LAB MANUAL

 Select individual components (Optional)


The Second Option gives an exhaustive list of components that you can install.
Choosing the workloads automatically selects the components that are part of that
workload. You can further customize what you want to install from this option. Select
the required components:

 Select language Packs (Optional)


The language is automatically picked up from the language configured from the

4
VISUAL PROGRAMMING LAB MANUAL
operating system. You can change it from this Tab.

 Select Installation Location

The final tab is the installation location. Change the location if you wish to

Step7: Installation

5
VISUAL PROGRAMMING LAB MANUAL
Now, click on the Install button to begin the installation of Visual Studio 2019.

The installer will now download each component from the internet and starts the
installation. This will take a while depending on your internet speed. Once the
installation is complete, you will be presented with the Installation succeeded message
along with the option to register.

 If you are installing Visual Studio for the first time you will be asked to sign in
Registration
 Next, Sign in window appears, you can Sign in or click on Sign up to create a new
account.
 In case if you wish to continue without Signing in click on “Not now, maybe later”
and proceed.
 You can sign in later from the option Help -> Register Product.

Part2: Getting started with Visual Studio 2019 and setting up IDE environment for C#
applications

After completing the installation process you need to run the visual studio and set the

6
VISUAL PROGRAMMING LAB MANUAL
environment for c# application by following the steps mentioned below.

1. Start application “Microsoft Visual Studio 2019”

2. In the “start page” of Microsoft Visual Studio .NET, choose new project

3. In “New Project” window, under “Project Types” choose “Visual C# Projects”,


under “Templates”

 Choose “Console Application” – to develop command line Programs

 (OR) choose “Windows Application” – to develop GUI components by drag


and drop

For 1st simple C# program, we will choose Console Application

Now, under “Name”, call it “FirstProgram”, under location


 You can choose default location given
 Or choose desktop or folder of your choice.
5. At this point the following class appears as shown in Figure.

The .NET environment adds some code pertaining to namespace, which is not

7
VISUAL PROGRAMMING LAB MANUAL
necessary for the 1st and simple program. Therefore, let’s modify it so that you are
aware of the essentials of a basic C# program. See Figure given below.

6. You can rename the class name, to anything you which, by right clicking on
“Class1.cs”, in the “Solution Explorer” frame and clicking on “rename”. When you do this
you must also delete “Class1” in the code view to whatever you called the class. See
Figure.

8
VISUAL PROGRAMMING LAB MANUAL

7. Now add the following code in the “Main” method Console.WriteLine(“This is my first
C# program!”); At this point, the class should look like as it does in Figure.

9
VISUAL PROGRAMMING LAB MANUAL

8. Now, to compile the program,


 Select the “Build” menu item from the top menu
 And select “Build Solution” from the drop down.
At the bottom of the window, the message “Build succeeded” should appear, informing
of successful compilation.

9. Now, to run the program,


 Select “Debug” menu item from the top menu
 And select “Start Without Debugging” from the drop down.
At this point, a new window should appear as in Figure on next slide.

10
VISUAL PROGRAMMING LAB MANUAL

Review Questions/ Exercise:


11
VISUAL PROGRAMMING LAB MANUAL

1. Write a program to that displays your name and roll no 10 times on separate line.

2. What is the role of comment in any programing language and how will you add
comments in your first program.
Comments are used to comment any line that is uncompible by compiler ,is used to put some info about
code and compiler does not compile that code.

12
VISUAL PROGRAMMING LAB MANUAL

3. Briefly discuss few methods of Console class.

In order to implement the user interface in console applications, Microsoft provided us with a class called
Console. The Console class is available in the “System” namespace. This Console class provides some
methods and properties using which we can implement the user interface in a console application

Beep() Play a beep sound using a PC speaker at runtime


Resetcolor() Reset the background and foreground color to its default state
Write(“string”) Display the specified message on the console window
WriteLine(“string”) Same as the write method but automatically moves the cursor to the next line after
printing the message.
Write(variable) Displays the value of the given variable
WriteLine(variable) Displays the value of the given variable along with moving the cursor to the next line
after printing the value of the variable.
Read() Read a single character from the keyboard and returns its ASCII value. The Datatype should be
int as it returns the ASCII value.
ReadLine()Reads a string value from the keyboard and returns the entered value only. As it returns the
entered string value so the DataType is going to be a string.
ReadKey()This method reads a single character from the keyboard and returns that character. The
Datatype should be int as it returns the ASCII value. It is a STRUCT Data type which is ConsoleKeyInfo.

13
VISUAL PROGRAMMING LAB MANUAL

Name:
Roll #:
Date:

Remarks
( Subject Teaacher)

14
VISUAL PROGRAMMING LAB MANUAL

15
VISUAL PROGRAMMING LAB MANUAL
Remarks:

16

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