Windows Forms Application:

It is used for developing an application for the desktops with effective User Interface.



“Whenever a class inherits

“System.Windows.Forms.Form” class then it is said to be an windows form.


To Create Windows Forms Application:




VS.Net IDE for Win form Development.

Too Box (Ctrl+Alt+X): It maintains all the controls that can be used within the Win form.


Properties Window (F4):

It is used to set or get value from the private or protected members of the class.


Solution Explorer (Alt+Ctrl+L):

It maintains all the files that are used within the application.

Form: It acts like a canvas where other controls can be drawn on it.




Label Control:

It is used to provide any static information on the Form.


Common Properties for all Windows Form Controls:

Name: Used to specify an unique identifier for the control.

Text: It is used to set or get the value from the control.


Text Box:

It is used to accept the single Line, Multi Line or password characters as the input.




If set to true then the user can provide input in multiple lines.


Scroll Bars: I

t is used to attach the scroll Bars to the control.


Password Char:

It is used to display the specified char on the text box instead of value typed by user


Button Control:

It is used to raise an action.


TrackBall Control:

It is used to allow the user for selecting a value within a range.




Save File Dialog Control:

It is used to project the dialog Window for saving the file within the system.


Open File Dialog Control:

It is used to project the dialog window for selecting the file which is present within the system.



The above two controls are used only to project dialog windows but they will not save the file or either open the file.


Common Properties of above two Controls:

Filter: Using to specify the filter expression to be used for displaying the files within the dialog window.


File Name:

Used to return the name of the file selected within the dialog window.


Common Methods for above two Controls:

Show Dialog ():

It is used to project the dialog window.



C: \program files\cs\Microsoft visual studio \common7 \VS2008\ image library \1033


For Button2                                                For Button3

Text: Record                                                Text: Close

Name: btn Record                                     Name: btnClose

Text Align: Bottom Center                    Text Align: Bottom Center

Image: - - -                                                   Image:  - - -

Image Align: Top center                       Image Align: Top center


In order to support speech API .Net uses System.Speech Name Space

Click on project [menu]

Add Refernce ()

.Net (Tab) ()

Select system speech


Code for Read button

Before write Name spaces

Imports System.Speech

Imports System Speech.Synthesis à provides classes to convert text to voice.

Code for Read button

Read (button_Click)

Dim SS as New speech Synthesizer à Provides methods to convert text to voice.

SS.Rate = tbSpeed.Value

SS.Volume = tbVolume.Value

SS.SelectVoice (“Microsoft SAM”)

SS.SpeakAsync (txtMessage.Text)


Record (button_Click)

Dim sfd as new SaveFileDialog

Sfd.Filter = “WaveFile\*.wav

Sfd.ShowDialog ()

Dim ss as new speechSynthesizer

ss.Rate = tb.Speed.Value

ss.Value = tb.Volume.Value

ss.SetOutput To WaveFile (sfd.FileName)

ss.Speak (txtMessage.Text)

ss.SetOutputTodefaultAudioDevice ()

MessageBox.Show (“Text recorded as voice”, VB270 “Text2Voice Convertor”)

Code for close

Close (button_Click)



ForForm Properties

Backcolor = __[--] (select)

Text = VB270 Text2voice Convertor

Icon: Select any good icon (.ico)

Start Position: Centre Screen [For the application to appear whenever executed]

Maximize: False (user can’t maximize form)


Web Browser Control:

It is used to provide the browsing capabilities to the Windows Form.

GroupBox Control:

It is used to logically group the controls together.



Designing our own Browser:

File menu Untitled new Project Untitled windows form application Untitled OK

Name: Vb270Webbrowser

Drag and drop group Box on form according to our request set the properties  as Untitled Dock: left, Text: options

Drag & drop another groupbox and set the property Dock: Top

In remaining space on form we want to develop broswer.

Drag & drop web browser control on remaining space .

In 1st Groupbox (options)

Select (drag & drop) button


Button Properties:

Text: Back

Name: btnBack

Textalign: bottom center

Image: select an image (ß) (path is in above program)

Image align: Topcenter

Put several buttons one under other in options Groupbox


Forward RefreshHome
Text: ForwardText: Refresh--- home
Text align: BottomcenterText align: BottomcenterText align: Bottomcenter
Name: btnforwardName: btnRefreshName: btnhome
Image: __ (Untitled)Image: --- (     )Select on image
Image Align: Top centerImage Align: Top centerImage Align: Top center


Read              Close

Read               Close

----                  ----

Btn read        btn close

---- (--)           ---- (--)

---- (--)           ---- (--)




For send Group box text = Address URL

Take Textbox under the text, place a button after this text box button properties

Properties: Name: txtURL

Name: btnGo, Image = select -> __    Untitled

Text: Go    UntitledImage Align: Middle Text


// Code for Go button

‘Go (button_Click)


Dim URL as String

URL = txtURL.Text

Dim protocol as string

Protocol = Mid (URL, 1, 4)

If protocol Upper = “HTTP”


txtURL.Text = “http: //” & URL

End if

Web Browser1.URL = New URL (txtURL.Text)

Catch ex as Exception

MessageBox.Show (ex.message, Me.Text)



End Try

We may have user enters a valid or invalid URL so depending on this we use to try that thing and if exception occurs we catch this so we use Exception handling.

In website find b4 www http: //to use this we have protocol. We have to read URL from middle of string for this we have mid

The user may enter URL in upper case lower case or both so we must try to convert into upper or lower

The user may enter http or not so we need to concatenate http with URL http: //& URL


Code for Back button

‘Back (button_Click)

webBrowser.GoBack ();

For Forward button_click

Webbrowser.Goforward ()


For Refresh

WebBrowser1.Refresh ()

For Home

WebBrowser1.GoHome ()


Click on project [menu] à add reference à Under .Net tab select System.Speech (OK)

Click on Read button for code

Write on top of public class Form1

Imports System.Speech

Imports System.SpeechSynthesis

Code for Read (button_Click)

Dim ss as new Speech Synthesizer


ss.Rate = 2

ss.Volume = 100

Dim msg as string

Msg = webBrowser1.Document.Body.OuterText (Text on in our site Untitled which is to be speaked out)

ss.SpeakAsync (msg)

Catch ex as Exception

ss.SpeakAsync (ex.Message)

MessageBox.Show (ex.Message, Me.Text)

End try

Code for close button


Execute and check



For form properties Text: vb270 WebBrowser with voice support

Icon: select a browser symbol

WindowState: Maximized.

Creating a basic setup project (if you want to give your s/w for others but not code)

Open soln.Explorer

Above oca application we find solution

Rclick on solution and select add new project

We find (+) other project type

Under this    visual studio installer

Select (1click) on this

And select setup project on middle of form.

Name vb270 Webbrowser with voice support

Click on OK

We get a form like

(+) Application Folder

(+) Users Desktop

(+) User’s program menu

Rclick on application and click add à add à project output click on others

Once we click on project out click OK


Again Rclick on application à add à file à (select an icon which we selected for our application)

Select Users Desktop

And Right click on Blank Frame | [Rclick]

And click on Create New shortcut

Then window will be opened

Click on application folder

Select “Primary output from vb270 Webbrowser

Click OK

Open properties of “Primary output from vb270 webbrowser”

Name: vb270 Webbrowser with voice support


Icon: Select Icon file what we have added to our program

Select Users program menu and Rclick and Add Folder

Name: vb270 batch application

Users program menu à vb270 batch applications

Select vb270 batch application and Rclick on blank frame and select create new shortcut and follow indtructions performed at users desktop.


After wards we find in menu bar Debug select this mode for deployment.



[There will be debug and release mode. Debug shows of there are errors do you want to debug to open VS IDE but in release mode it says if errors are there errors and do you want to terminate application.]

[If our project is under construction we select debug]

[If our project is completed we select release]

Click on Build menu & Build solution

Go 2 solutions Explorer Rclick on our application (vb270 Webbrowser with support) and click on build.

Save it as your wish


Timer Control:

It is used to execute a set of instructions repeatedly for every specific interval of time.




Specify the duration in milliseconds to halt the timer control execution.



It is used to enable or disable the execution of the timer control.




Executes the code present within the Event handler for every elapsed time provided at the interval of timer control.

Ex: Take WIN FORM application.





Below the form drag & drop timer control that area is called as Component tab.

Label1 Untitled Id = lbttime

Button1 Untitled Id = lb1start watch, text = Start watch

Button2 Untitled Id = lb1start watch, text = Stop watch

Timer1 Untitled Interval = 1000

Enable = False (code written in timer would not be execute)

Double click on Timer Control


Code for Timer


Lb1Time.Text = Now ToLongTimeString


Code for start button1 (start watch)

‘Start Watch

Timer1.Enabled = true


Code for stop watch (stop button)

            ‘Stop Watch

Timer1.Enabled = false



Image list:

It is used to maintain a collection of images which can be used by any control that has a capability to project the image.

Draw some images in order to make animation



Picture Box:

It is used to project an image.



Image URL:

Specify the URL of the image to be displayed.


Size mode:

Specify the mode of image to be displayed.



Picture Box1: Mode = stretched

Button 1: Id = btn start UntitledId = btn pause  Untitled   btn continue Untitled  btn close Untitled  Text = start   = pause         continue Untitled  close

Drag & drop timer control, image list control below form

For Timer1  Untitled  Enabled = false  Untitled  Interval = 500

Click on Image List Task (|<|)

Image size: 255, 255

Image list Depth: Depth 32 bit

Choose Images à click on this

Add and select all images created by us for animation.


Timer1 code:

Above Timer code in class Form2

‘Form declarations

Dim index as Integer = 0


Code in Timer:


If Index > ImageList1.Images.Count – 1

Then index = 0

pictureBox1.image = ImageList1.Images (index)

Index t = 1


Code for start button

‘Start (button_Click)

Timer1.Enabled = True

btnStart.Enabled = False


Pause btn:

‘Pause (button2_Click)

Timer1.Enabled = False


Continue btn:

‘Continue (button3_Click)

Timer1.Enabled = True


Close btn:

‘Close (button4_Click)


Untitled ADD.Net usage

Open windows forms application

Name: VB270SQL Client Tool




For Label1:For Label2:        For label3:
Text: Enter your statementText: history     Name: |b|result


For Button1:For Button2:For Button3:For Button4:
Text: ExecuteText: ClearText: Clear HistoryText: Close
Name: btn ExecuteName:Name: btn clear historyName: btn close


For Grid View
Name: dgv Results



For Text Box
Name: txt Stmt
Multiline: True
Scrollbars: Vertical