0% found this document useful (0 votes)
2 views36 pages

DCSA

Visual Studio 2008 is an Integrated Development Environment (IDE) from Microsoft used for creating various applications, including web and mobile apps, and supports multiple programming languages. It offers features like IntelliSense, code refactoring, and a comprehensive debugging environment, enhancing productivity and simplifying the development process. The document also outlines the installation process, system requirements, and benefits of the .NET Framework, which is essential for using Visual Studio 2008.

Uploaded by

asibiqbal3
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)
2 views36 pages

DCSA

Visual Studio 2008 is an Integrated Development Environment (IDE) from Microsoft used for creating various applications, including web and mobile apps, and supports multiple programming languages. It offers features like IntelliSense, code refactoring, and a comprehensive debugging environment, enhancing productivity and simplifying the development process. The document also outlines the installation process, system requirements, and benefits of the .NET Framework, which is essential for using Visual Studio 2008.

Uploaded by

asibiqbal3
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/ 36

Getting started with visual studio 2008

Unit 1

Getting started with visual studio 2008


Introduction
Visual Studio 2008 is an Integrated Development Environment (IDE) of
Microsoft Corporation. It was released in the year of 2008. It is used to
create and develop console based and graphical user interface (GUI)
applications along with Windows Forms applications, web sites, web
applications, web services, and also mobile based applications for .NET
framework. It is used for all platforms supported by Microsoft Windows,
Windows Mobile, Windows CE, .NET Framework, .NET Compact
Framework and Microsoft Silverlight. It includes a code editor supporting
IntelliSense as well as code refactoring. Visual Studio 2008 supports
different programming languages such as visual basic (VB) or visual
basic dot net (VB.NET), visual C #(C sharp), visual C++, ASP .NET. It
also supports XML/XSLT, HTML/XHTML, JavaScript and CSS. Visual
Studio's role is to improve the process of development and make the work
of achieving breakthroughs easier and more satisfying. Visual Studio
2008 can improve the process of development in such ways which are
productive, integrated, comprehensive and reliable. It supports running
multiple instances of the environment. It includes a debugger that works
both as a source-level debugger and as a machine-level debugger. It
works with both managed code as well as native code and can be used for
debugging applications written in any language supported by Visual
Studio.

Lesson 1.1

Introduction to visual studio 2008


Upon completion of this unit you will be able to

 Explain benefits of using visual studio 2008.


 State precious features of visual studio 2008.
 Describe benefits of .NET Framework.

Outcomes

6
Visual Programming

Benefits of using visual studio 2008


Visual studio 2008 is used primarily by Software Developers to build
Software products, websites and Utilities. It is a developer tool; it is
perfectly safe to run on your systems. However you will need to include it
in your software licensing audit.

By using visual studio 2008 we can


 Build Higher-Quality Applications.
 Avoid Memorizing Syntax.
 Write Less Code.
 Handle Data More Productively.
 Program in Multiple Languages.
 Helps in minimizing the development time.
 Simplifies the process of testing application.
 Enhancements in data retrieval and data binding.
 Supports multiple versions of .NET Framework.
 Integrates with .NET Framework 3.5
 Inspects code to find sections of code that need to be refactored.
 Provides supports for Web, mobile, client, Vista and office
applications development.
 Collaborate with UI Designers.
 Build Specialized Software.
 Collaborate with Web Designers.
 Easily Deploy and Update Applications.
 Manage and Synchronize Data.

Features of visual studio 2008


Visual studio 2008 is an IDE designed for writing, compiling and
debugging the code in much easier way. It contains a complete set of
development tools for building ASP.NET web applications, web services,
desktop applications and mobile applications. Visual Studio 2008 does
not include any source control support built-in but it defines two
alternative ways for source control systems to integrate with the IDE.
A Source Control Visual studio package (VSPackage) can provide its
own customized user interface. In contrast, a source control plug-in using
the MSSCCI (Microsoft Source Code Control Interface) provides a set of
functions that are used to implement various source control functionality,
with a standard Visual Studio user interface.
New features in visual studio 2008 are as follows:
i. Support for multi-targeting
ii. Support for multithreading applications
iii. Supports structured exception handling, using an enhanced version

7
Introduction to visual studio 2008

of the Try…….Catch……..Finally syntax supported by other languages


(Such as C++).
iv. Support for Language Integrated Query (LINQ).
v. Improved deployment.
vi. Support for client application services.
vii. Web designer and CSS support.
viii. Reporting application support.
ix. HTML split view designer.
x. Support for JavaScript Intelligence.
xi. Office designer support.
xii. ASP.NET, AJAX and JavaScript Support.

Benefits of .NET Framework


.NET Framework (pronounced dot net) is a software framework
developed by Microsoft. It is an essential component of the windows
operating system. It includes a large library and provides language
interoperability across several programming languages such as visual C#,
visual basic, visual J# and visual C++. The .NET Framework consists of
the common language runtime (CLR) also called virtual executing system
and the .NET Framework class library. The CLR is the foundation of the
.NET Framework. The .NET Framework class library is a collection of
reusable types that tightly integrate with the common language runtime.
The .NET Framework can be hosted by unmanaged components that load
the common language runtime into their processes and initiate the
execution of managed code, thereby creating a software environment that
can exploit both managed and unmanaged features. The .NET Framework
not only provides several runtime hosts, but also supports the
development of third-party runtime hosts. It is used to combine the
commerce logic of applications developed in different programming
languages and services.

Let‘s now explore some of the benefits of .NET Framework, which are as
follows:
i. Consistent programming model.
ii. Cross-platform support.
iii. Language interoperability.
iv. Automatic management of resources.
v. Ease of deployment.
vi. Code execution environment.
Above benefits of .NET Framework are describe bellow:

Consistent programming model: .NET Framework provides a


consistent object-oriented programming model across different languages.
It provides a Consistent object oriented programming environment
whether object code is stored and executed locally, executed locally but

8
Visual Programming

internet distributed, or executed remotely. We can use this model to


create programs for performing different tasks, such as connecting to and
retrieving data from databases and reading from and writing to files.

Cross-platform support: This property is also called portability. Any


windows platform that supports CLR and execute a .NET application.

Language interoperability: It is a one kind of feature that enables


programs written in different language to interact with each other. It
allows reusability of code and improves the efficiency of the development
process.

Automatic management of resources: It can automatic manage the


resources. In .NET framework need not to manually free the application
resources like files, memory, networks and database connections.

Easy of deployment: .NET Framework makes the task of deployment


easier. It enables easy deployment of applications by installing new
applications or apparatus that do not have adverse effect on the existing
applications. In this Framework applications are deployed in the form of
assembles.

Code execution environment: This framework works on object-oriented


programming. This helps to eliminate the amount of unnecessary codes
and involves less coding for the developers. Developers enjoy working on
this platform as it increases their productivity.

Components of .NET Framework 3.5


.NET framework 3.5 is the essential component in visual studio 2008.
When you installed the visual studio 2008 it is required to installed .NET
framework 3.5. The essential components of .NET Framework 3.5 are as
follows:
i. .NET Framework Class Library (CL).
ii. Common Language Runtime (CLR).
iii. Common Language Specification (CLS).
iv. Common Type System.
v. Windows Forms.
vi. Metadata and Assembles.
vii. ASP.NET and ASP.NET AJAX.
viii. ADO.NET.
ix. OLEDB.
x. Windows Workflow Foundation (WF).
xi. Windows Presentation Foundation (WPF).
xii. Windows communication Foundation (WCF).
xiii. Windows CardSpace.
xiv. Language Integrated Query (LINQ).

9
Introduction to visual studio 2008

Advantages of Visual Programming


Visual Programming enables
(i) Visual development of graphical user interface which are easy to
use and easy to learn.
(ii) Visual programming environment displays a list of available
components. The programmer picks up the required component
from this list to display it.
(iii) The programmer can create the user interface visually he can align,
move or size the component as required without having to resort to
writing code.

10
Visual Programming

Lesson 1.2

Installation procedure of visual studio 2008


Introduction
To explore visual studio 2008, you need to first install it. However, before
starting installation process, you should take care of several issues in
advance to reduce the probability of encountering problems such as
editions of visual studio, system requirements.

Upon completion of this unit you will be able to

 Describe the various editions of visual studio 2008.

 State System requirements for visual studio 2008.

 Explain installation process of visual studio 2008.


Outcomes

Editions of visual studio 2008


Visual studio has four (04) editions such as
1. Express Edition
2. Standard Edition
3. Professional and
4. Team System Edition

The languages include with visual studio are visual basic, Visual C++,
Visual C# (C sharp) and Visual J#. The above editions details are
described below:

Visual Studio Express Edition: Visual Studio Express Edition is a set of


free lightweight IDEs that are provided as reduced version of the visual
studio IDE. It is easy to use and easy to learn. This edition lacks a lot of
the project types and lack of remote database support for data designer
and class designer. This edition does not use the full Microsoft Developer
Network (MSDN) library but use the MSDN express library.

Visual Studio Standard Edition: This edition provides an integrated


IDE for all supported products. It also supports the complete MSDN and
editing of XML and extensible Style sheet Language Transformation
(XSLT).
Visual Studio Professional Edition: This edition includes all the tools

11
Installation procedure of visual studio 2008

available in visual studio Standard as well as it has integration with


Microsoft SQL server and has a remote debugger.
Visual Studio Team System: visual studio team system includes a set of
software development and reporting tools, in addition to the features
provided by visual studio professional edition. It offers the following
toolsets based on the development role, it is being used for:
 Team Explorer
 Architecture Edition
 Database Edition
 Development Edition
 Test Edition
In this book we will be shown the installation procedure of Visual Studio
Team System 2008. All examples of this book are shown using Visual
Studio Team system IDE and its components. But you can also use any
above edition IDE and its component.

System Requirements
The various hardware and software requirements that are needed to install
the visual studio 2008 are given below:
SL. No Hardware and software Requirements

1. Processor Minimum 1.6 GHz Pentium processor


Recommended : 2.2 GHz or higher
Pentium processor or core I or dual core
processor
2. Supported architecture X86(32 bit) and x64(64 bit)
3. Operating Windows XP service pack 2, Windows 7,
System(OS) Windows 8 or above, Windows Server
2003 Service pack 1 or above, Windows
Server 2003 R2 or above, Windows
Vista, Windows Server 2008
4. Random Access Minimum: 384 MB,
Memory(RAM) Recommended : 1 GB or more
On windows Vista : 768 MB
5. Hard Disk Minimum:5400 Revolutions Per
Minute(RPM), 40 GB
Recommended: 7200 RPM or 80 GB or
Higher.
6. Hard Disk space For minimum installation: 1.22 GB of
available hard disk space.
For full installation: 5 GB of available
hard disk space.
7. DVD-ROM Drive Latest DVD-ROM drive.
8. Display Minimum: 1024 X 768 display
Recommended : 1280 X 1024 display

Installation process
The following are the steps to be taken to install visual studio 2008:

12
Visual Programming

Step 1: insert the DVD of visual studio 2008 in the DVD-ROM drive.
The visual studio 2008 setup wizard appears as follows:

Figure 1: The visual studio 2008 Setup Dialog Box

Step 2: Now click on the Install Visual Studio 2008 link, as shown in
Figure 1. The setup wizard will start copying needed files into temporary
folder. Here you should just wait few times. The Visual Studio 2008
installation starts as follows:

Figure 2: Page showing loading installation components

Step 3: After few seconds a welcome setup wizard will appear look like
the following:

13
Installation procedure of visual studio 2008

Figure 3: Visual studio 2008 welcome setup wizard

Step 4: Now just click the Next button to go to the next step. Now you
will look like the following screen:

Figure 4: Visual studio 2008 setup screen

Step 5: Now Select the radio button beside the I have read and accept the
license terms option, as shown in Figure 4 and then click next button to
continue. A new option page appears as shown in Figure 5:

14
Visual Programming

Figure 5: Visual studio setup option page dialog

Step 6: Now select the Full radio button as shown in Figure 5, because
we are going to install full features of visual studio 2008. If you want you
can select any one of the radio buttons. Now just click Install button as
shown in Figure 5. After clicking install button the visual studio 2008
stats installation and following screen will appear:

Figure 6: Visual Studio 2008 installation components dialog.


Step 7: Now just wait and see the step-by-step, Visual Studio 2008
components being installed.

15
Installation procedure of visual studio 2008

Step 8: After a few minutes, if the installation is completed successfully


the following screen will appear:

Figure 7: Visual Studio 2008 Finish page dialog

Step 9: Now just click the Finish button to complete installation as shown
in Figure 7.

16
Visual Programming

Lesson 1.3-1.5

Exploring Integrated Development Environment


Introduction
An Integrated Development Environment (IDE) or interactive
development environment is a software application that provides
comprehensive facilities to computer programmers for software
development. Integrated development environments are designed to
maximize programmer productivity by providing tight-knit components
with similar user interfaces. Visual Studio 2008 IDE provides tools for
developing different kinds of applications, such as Windows forms
applications, Web Application, WPF applications mobile applications and
so on. The IDE can also be used for detecting and correcting errors in the
application.

Upon completion of this unit you will be able to:

 Run visual studio 2008.

 Familiar basic windows of visual studio 2008 IDE.


 Define design time, run time, and debug time.
Outcomes

How to run Visual Studio 2008


Visual Studio is a powerful and customizable programming workshop
that contains all the tools you need to build robust programs for Windows
and the Web quickly and efficiently. Most of the features in the Visual
Studio IDE apply equally to Visual Basic, Microsoft Visual C++, and
Microsoft Visual C#. When you run Visual Studio 2008 for the first time,
you will be prompted to select the type of projects you plan to build with
Visual Studio, so that the environment can be optimized for that specific
type of development.
Now for start the visual studio 2008 follow the following steps:
Step 1: On the Windows taskbar, click Start, click All Programs, and then
click the Microsoft Visual Studio 2008 folder. The folders and icons in
the Microsoft Visual Studio 2008 folder appear in a list. Click the
Microsoft Visual Studio 2008 icon.
StartAll programsMicrosoft Visual Studio 2008Microsoft Visual
Studio 2008 icon
When you run Visual Studio 2008 for the first time you will look the
following window:

17
Installation procedure of visual studio 2008

Figure 1: Default Environment setting window


Step 2: Now select visual basic development setting from the choice
option and then click Start Visual Studio button as shown in Figure 3.1.
After clicking, the following window will appear:

Step 3: After a few minutes you will look the following window:

Figure 2: Visual Studio Start Page

18
Visual Programming

Step 4: On the Start Page of Visual Studio, you will see the following
panes:
i. Recent project.
ii. MSDN: Visual Studio.
iii. Getting started.
iv. Visual Studio Headlines.

Recent project: Here you see a list of the projects you opened most
recently with Visual Studio, and you can select the one you want to open
again— chances are that you will continue working on the same project
as the last time. Each project‘s name is a hyperlink, and you can open it
by clicking its name. At the bottom of the Recent Projects section are two
hyperlinks, for opening or creating another project.

MSDN: Visual Studio: This section is a browser window that displays


an MSDN (the Microsoft Developer Network, which is the definitive
resource for all Microsoft technologies and products) page when the
computer is connected to the Internet. In this section, you will see news
about Visual Studio, the supported languages, articles, and other
interesting bits of information.

Getting Started: This section contains links to basic programming tasks


in the product‘s documentation.

Visual Studio Headlines: This section contains links to announcements


and other news of interest to VB developers.

Basic windows of visual studio 2008 IDE


Visual Studio 2008 IDE has the following different parts:
1. Menu Bar
2. Toolbars
3. Toolbox
4. Code Editor
5. Designers
6. Solution Explorer
7. Properties Window
8. Server Explorer
9. Output Window
10. Error Window

Menu Bar: The menu bar of the visual studio IDE provides different
menus for different Visual Studio commands as shown in figure:

Figure 3: Menu Bar

Toolbars: A toolbar is a GUI widget on which on-screen buttons, icons,

19
Installation procedure of visual studio 2008

menus, or other input or output elements are placed. Toolbars are shortcut
to the most frequently performed actions. You will find several common
toolbars on the visual studio IDE such as Standard, Layout, Formatting,
Debug etc. as shown in following Figure:

Figure 4: Toolbars

Toolbox: The toolbox contains a number of tabs and each tab contains a
list of controls and components that can be placed on a form. The toolbox
is docked on the left side of the IDE. If it is not visible, you can bring
toolbox from the View menu or press the CTRL+ALT+X keys together to
open it. The Toolbox is shown in following Figure:

Figure 5: The Toolbox

From the Toolbox, it is seen that the Toolbox uses tabs, such as all
windows Forms, Common Controls, Containers, Menus & Toolbars,
Data, Components, Printing, Dialogs, WPF interoperability, Reporting,
Visual Basic PowerPacks and General to categorize different controls and
components.

Descriptions of all tabs are given below:

20
Visual Programming

SL No. Tab Name Description

1. All Windows This Tab contains all standard windows


Forms forms controls.

2. Common This tab contains all common controls


Controls typically used in windows forms project.

3. Containers This tab contains controls such as


GroupBox and Panel controls that include
other controls.

4. Menus & This tab contains control that are used to


Toolbars creating menus and toolbars for your
applications.

5. Data This tab contains controls that help in


working with database.

6. Components This tab contains components that do not


have a user interface.

7. Printing This tab contains controls that help in


providing printing capabilities to your
Windows Forms projects.

8. Dialogs This tab contains controls that help you in


using common dialog boxes in your
application.

9. WPF This tab contains a control that can be used


interoperability to host a WPF component.

10. Reporting This tab contains controls for proving


reporting services such as crystal report.

11. Visual Basic This tab contains a component that allows


PowerPacks you to print a duplicate copy of a form as it
appears on the screen.

12. General This tab is initially empty.

Code Editor: If you select Code View within the Project Window, or if
you double-click on a control icon within the Form Design Window, the
Code Editor Window will open, displaying the Visual Basic code
associated with a particular object. You use the Code Editor Window to
write, display, and edit Visual Basic code. You can press F7 key to switch
from windows Forms Designer to the code editor. On the other hand you
can switch Code editor by selecting View Code. You must write the
Code between Class. Code editor is shown in following Figure:

21
Installation procedure of visual studio 2008

Figure 6: The coding editor


Designers: Designer is used to design windows application as well as
web applications or WPF. It can be used to define the behavior or
appearance of the components and controls in the design view. When you
create a windows forms application in visual studio, a form is
automatically added to the project which is described later chapter. You
can resize the Form window to make the windows you create in your
applications as large or small as needed. The windows forms designer
enables you to add controls to the form, arrange them and write code for
essential events of the control. The simple windows form application
shown in below:

Figure 7: The windows forms designer

Solution Explorer: Solution explorer window holds each project, project


reference and components. By default it shows the right side of visual

22
Visual Programming

studio IDE. If it is hidden, you can active solution explorer in the IDE,
click on View Solution Explorer or press CTRL+ALT+L keys together.
The solution explorer gives you a graphical representation of all the files
that make up your project. When you double click on any file in your
project from the solution explorer, it opens quickly. The Solution
Explorer window and the Window‘s title bar hold the name of your
solution (.sln) file, which is WindowsApplication1 by default unless you
give it a new value in the New Project dialog box. The following Figure
shows a solution explorer window:

Figure 8: Solution Explorer window

Properties Window: The Properties Window is docked under the Project


Explorer window. Each object in Visual Basic has characteristics such as
color and size etc. All the characteristics of an object are called its
properties. Properties window in visual studio is used to set properties for
various objects at design time. When you select a component or object in
the solution explorer window or designer, the properties associated within
the selected component are displayed in the properties window. By
default it shows right bottom corner on visual studio IDE. If it is hidden,
you can active it. To view the properties window you click on the
ViewProperties window from the menu bar or press F4 key. When you
want to change the properties of a control or component, just click on that
control on windows forms, then change the property as you want from
properties window. This window also enables you to edit the properties of
the controls that you add to forms. The properties window is shown in
below:

23
Installation procedure of visual studio 2008

Figure 9: The properties window

You can sort the properties in the window either alphabetically or by


categories. Use the buttons on the Properties window.

Tip
Server Explorer: The server explorer window allows you to view the
various services that are available on a specific server. It is a powerful
tool that provides drags and drop feature. Server explorer helps you to
work with database in easy way. It is a sever management console for
visual studio. You can use the server explorer to list database tables,
views, stored procedures, and functions. If Crystal Reports is installed on
your computer, you can create a report directly from server explorer.
Using server explorer, you can view and manipulate data link, database
connections, and system resources on any server, which is connected to
the network. By default server explorer contains two nodes such as i)
Data Connections and ii) Servers. To view the server explorer, click on
the ViewServer Explorer or press CTRL+ALT+S keys together. The
server explorer window is shown in following Figure:

Figure 10: Server Explorer Window

24
Visual Programming

Output Window: The output window displays the result of building and
executing applications. By default the output window shows at the bottom
of the visual studio IDE. If it is hidden, to view the output window, click
View Output or by pressing CTRL+ALT+O keys together. The output
window is shown in following window:

Figure 11: The Output Window

Error window: The error window displays the various types of error
such as syntax error, typing error, variable declaration error etc
automatically. When you type the code on editor, if it is an error, it will
display automatically on Error window as error list. The error list displays
error with details that is its description, file number, line number, column
number and project name. To view the error list, click ViewError List
or by pressing CTRL+E keys together. the error window is shown in
following Figure:

Figure 12: The Error Window.

The error list toolbar consists of the following options:

Errors: This option displays the number of errors in the list. Click this
option to see whether errors are displayed

Warnings: This option displays the number of warnings in the list.

Messages: This option displays the number of messages in the list. Click
this option to see whether messages are displayed.

Design Time, Run Time, and Debug Time


Visual Basic has three distinct modes. While you are designing the user
interface and writing code, you are in design time. When you are testing
and running your project, you are in run time. If you get a run-time error
or pause program execution, you are in debug time. The IDE window
title bar indicates running or debugging to indicate that a project is no
longer in design time.

25
Installation procedure of visual studio 2008

Lesson 1.6-1.8

Creating, saving and running windows application


Introduction
Although the programming language you‘ll be learning in this book is
Visual Basic, the development environment you‘ll be using to write
programs is called the Microsoft Visual Studio Integrated Development
Environment or IDE for short. Visual Studio is a powerful and
customizable programming workshop that contains all the tools you need
to build robust programs for Windows and the Web quickly and
efficiently.

Upon completion of this unit you will be able to:

 Create a simple visual basic project.


 Save a simple visual basic project.
 Run a simple visual basic project.
Outcomes  Change the Form‘s background color.

Open/ Start visual studio 2008


To open or start visual studio 2008 follow the following steps:

Step1: On the Windows taskbar, click Start, click All Programs, and then
click the Microsoft Visual Studio 2008 Folder then Click the Microsoft
Visual Studio 2008 icon for windows 7.
For windows 7:
StartAll ProgramsMicrosoft Visual Studio 2008 Folder Microsoft
Visual Studio 2008 icon.
For windows XP:
Start Microsoft Visual Studio 2008Microsoft Visual Studio 2008
icon
You will see the following figure:

26
Visual Programming

Figure 1: Visual studio 2008 start page

Creating a simple visual basic project


At this point, you can create a new project and start working with Visual
Studio. To create a simple visual basic project follows the following
steps:

Step 1: Start visual studio according to above step, you will look like
following figure:

Figure 2: Visual Studio Start page


Step 2: Click project of create option which is shown in above figure 1.
Or click File from the menu bar and the click New Project which is
shown in following Figure:

27
Installation procedure of visual studio 2008

Figure 3: New project Option page

Step 3: After Clicking Project or New Project option you will look like
following window:

Figure 4: New Project dialog box

Step 4: Now select Windows option under Visual Basic as project Types
from the left pan of the window. Then select Windows Forms Application
template. Now give project name on the name text field as Firstvbproject
then click ok button, which is shown in figure 4. Now you will look like
the following Figure:

28
Visual Programming

Figure 5: The integrated development environment of Visual Studio 2008


for a new project

Step 5: By default Form1 is created. When you click on form1 window


you will look corresponding toolbox component, properties window and
solution explorer window on visual studio IDE.

Step 6: Now drag a TextBox control from the Toolbox and drop it on
Form1, which is shown in following figure:

Figure 6: Visual Studio IDE with a TextBox Control

Step 7: Now drag a Button control from the Toolbox and drop it on
Form1, which is shown in following Figure:

29
Installation procedure of visual studio 2008

Figure7: Visual Studio IDE with a TextBox and Button control

Step 8: Now single click on TextBox of the Form1 and increase it either
left or right using cursor, which is shown in following figure:

Figure 8: Visual Studio IDE with a TextBox and Button control after
increasing TextBox

Step 9: Now double click on Button1 control of the Form1, you will see
the following window:

30
Visual Programming

Figure 9: Button1 Coding window

Here you will look the following code under Button1:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button1.Click

End Sub

Step 10: Now type the following code before End Sub. When you start
type code a dropdown window will be appeared as like following figure:

Now type the following code before End Sub:

TextBox1.Text = "Bangladesh Open University"

31
Installation procedure of visual studio 2008

Now you will look like following figure:

Step 10: Now for saving project, click File, then click Save All or press

CTRL+Shift+S keys together or click icon from toolbar, then you


will look like the following save project dialog window:

FileSave All

Figure 10: Save Project dialog box

Here, you can change your project name, location etc. By default your
project will save on C drive. If you want to change your location just
click on browse button and select location from your computer. Now, just
click on save button. The project will save your selected location.

Step 11: Now for running your project, click on Debug Start
Debugging from Menu bar or press F5 key or click on icon from
toolbar. Now you will look like following figure:

32
Visual Programming

Step 12: After running the program just click on Button1 then you will
look the text ‗Bangladesh Open University‘ on textbox of Form1, which
is shown in following figure:

33
Customizing windows forms

Lesson 1.9

Customizing windows forms


Introduction
Windows Forms controls are reusable components that encapsulate user
interface functionality and are used in client-side Windows-based
applications. Not only does Windows Forms provide many ready-to-use
controls, it also provides the infrastructure for developing your own
controls. Windows Forms controls are objects that users can interact with
to enter or manipulate data.

Upon completion of this unit you will be able to:

 Customized appearance of a windows form.

Outcomes

Changing the appearance of a windows form


Step 1: Start visual studio 2008 and create a windows based project, and
give the name of project is ‗Login‘. The window will look like the
following:

34
Visual Programming

Step 2: After clicking the ok button, the following window will be


appeared, where by default a form will be generated automatically.

Step 3: Now we will give form name. So, just single click on Form1.vb
under Solution Explorer window, and give the name ‗frmlogin‘ as like
following:

Step 4: Now we will change the text of from. So, just single click on
windows form and change the property of form from the right side
property panel. Now change the text property of form as like following:

35
Customizing windows forms

Now the form will look like the following:

Change your application‘s Form file name (Form1.vb) to a name that


describes the application‘s purpose

Tip

Step 5: Now change the form ControlBox property from the properties
panel. By default, it is selected as True. Now you change it as False as
follows:

36
Visual Programming

Now the form will look like the following:

Step 6: Now we want to change the form backcolor. So change the form
backcolor property from the properties panel. When you select the
backcolor property, you will look three color tabs such as Custom, Web,
and System. You can select any type of color from this tabs which you
want. Now select web tabs, and select tomato color which looks like the
following:

37
Customizing windows forms

Now the form will look like following:

If the Properties window is not visible, you can choose View / Properties
Window from the menu or press the F4 shortcut key to show it.

Tip

Step 7: Now save all the projects by clicking on save all icon from
the toolbar.

38
Visual Programming

Step 8: Now run the program or form by clicking on run icon from
the toolbar. You will look like the following:

Step 9: Now for stop the running program, just click on Stop
debugging icon from toolbar.

39
Customizing windows forms

Assessment
MCQ
1. To save all the project‘s files, select _______
Assessment a) Save > Solution > Save Files b)File > Save
c) File > Save All d)File > Save As….
2. The Form‘s property specifies the text that is displayed in the Form‘s
title bar.
a) Title b)Text
c) (Name) d)Name
3. Property specifies how text is aligned within a Label‘s boundaries.
a) Alignment b)AlignText
c) Align d)TextAlign
4. In which mode, the application is executing.
a) start b) run
c) break d) design.
Exercise
1. Write the purpose of the following file types in Visual Basic
i) .vb ii) .frm iii).exe
2. What are the advantages that visual basic have, which makes it an
excellent programming tool?
3. What is IDE? Discus the following components of IDE i.e. Project
Window, Property window, Form Window and Code Editor Window.

40
Visual Programming

41

You might also like