Structure OF Programming Languages

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 43

STRUCTURE

OF
PROGRAMMING
LANGUAGES
VISUAL BASIC
.NET
CONTENTS:
1. What is Visual Basic .NET?

3. Visual Basic .NET User Interface

5. Visual Basic .NET Versions

7. Operating Visual Basic .NET

9. Visual Basic .NET Controls

11.Keywords, Functions and Statements


VISUAL BASIC .NET
§VISUAL BASIC (VB), FORMERLY
CALLED THE VISUAL BASIC .NET (VB
.NET), IS AN OBJECT ORIENTED
COMPUTER PROGRAMMING
LANGUAGE THAT CAN BE VIEWED
AS AN EVOLUTION OF MICROSOFT’S
VISUAL BASIC (VB) IMPLEMENTED
ON THE MICROSOFT .NET
VISUAL BASIC START UP
PAGE
VISUAL BASIC USER
INERTFACE
SYSTEM REQUIREMENT:

DEVELOPER : MICROSOFT

OPERATING SYSTEM : MIROSOFT


WINDOWS , MS-DOS
VERSIONS OF VISUAL
BASIC .NET
§Visual Basic .NET

§Visual Basic .NET 2003 (VB 7.1)

§Visual Basic 2005 (VB 8.0)

§Visual Basic 2008 (VB 9.0)

§Visual Basic 'VBx' (VB 10.0)


OPERATING THE VISUAL
BASIC SURROUNDING AND
CREATING PROGRAMS
There's a lot happening on the start page.
But basically, this is where you can start a
new project, or open an existing one. The
first Tab, Projects, is selected. At the
moment, the area labelled "Open an
Existing Project" is blank. This is what you'll
see when you run the software for the first
time (because you haven't created a project
yet). When you create a project, the Name
you gave it will be displayed on this page,
as a hyperlink. Clicking the link will open
the project.
At the bottom of the screen, there are two buttons: "New
Project" and "Open Project". To get started, click the "New
Project" button. When you do, you'll see this dialogue box
appear:
As a beginner, you'll normally want the option
selected: "Windows Application", in the "Visual
Basic Projects" folder. This means that you're
going to be designing a programme to run on a
computer running the Microsoft Windows
operating system.
If you look in the Name textbox at the bottom,
you'll see it says "WindowsApplication1". This is
the default name for your projects. It's not a
good idea to keep this name. After all, you don't
want all of your projects to be called
"WindowsApplication1", "WindowsApplication2",
Click the OK button, and the Visual Basic NET design time
environment will open. It will look like the following (the 2008
edition is just the same):
In the Visual Basic NET design time environment,
the first thing to concentrate on is that strange,
big square in the top left. That's called a form. It's
actually the pretty bit of your programme, the
part that others will see when they launch your
masterpiece. Granted, it doesn't look too
attractive at the moment, but you'll soon discover
ways to lick it into shape. To run the form, try this:

From the menu bar, click Debug


From the drop down menu, click Start
Alternatively, press the F5 key on your keyboard
Your programme is launched
You have now created your very first
programme. It should look like this:

Click the Red X on the form to stop it from running. You


will then be returned to the software environment.
Be aware that there's a two step process to
VB programming: designing and
debugging

§Design Time is where you get to play about


with the form, spruce it up, add textboxes,
and buttons, and labels (and code, of
course )

§Debug is where you can test your


programme and see how well it performs.
Things like buttons, textboxes, and labels are all
things that you can add to your Forms. They are
know as Controls, and are kept in the Toolbox for
ease of use.

The Toolbox can be found on the left of the screen.


In the picture below, you can see the toolbox icon
next to Form1:
To display all the tools, move your mouse over the
toolbox icon. You'll see the following automatically
appear:
There are seven categories of tools available. The toolbox
you'll be working with first is the Common Controls
toolbox. To see the tools, click on the plus symbol next to
Common Controls. You'll see a long list of tools:
Let's start by adding a textbox to our form. With the tools
displayed, do the following:

Locate the TextBox tool


Double click the icon
A textbox is added to your form

The textbox gets added to the top left position of your form. To
move it down, hold your mouse over the textbox and drag to a
new position:
Notice the small squares around the textbox.
These are sizing handles. Move your mouse over
one of them. The mouse pointer turns into an
extended line with arrowheads. Hold your left
mouse button down and drag outwards. The
textbox is resized. Play around with the sizing
handles until you're happy with the size of your
textbox.

One thing you will notice is that you can't make


the size any higher, but you can make it wider.
The reason why you can't make it any higher is
because the default action of a textbox is to have
it contain only a single line of text. If it's only
going to contain one line of text, Microsoft
reasoned, there's no reason why you should be
Create two more textboxes by double clicking on the
textbox icon in the toolbar (Or Right-click on the
selected textbox and choose Copy. Then Right-click
on the Form and choose Paste.)

Resize them to the same size as your first one

Line them up one below the other with space in


between

Try to create something that looks like the one


Let's add some labels near the textboxes so that your users
will know what they are for.

Locate the label control in the toolbox


Double click the label icon
A new label is added to your form
It should look like the one below

Click on the label to select it. Now hold your left mouse
button down on the label. Keep it held down and drag it
to the left of the textbox.
Create two more labels, and position
them to the left of the textboxes. You
should now have a form like this one:
To see what your Form looks like as a
programme, click Debug > Start from
the menu bar. Or press F5 on your
keyboard:
To stop the programme from running, you can
do one of the following:
1. Click the Red X at the top right of your Form
2. Click Debug > Stop Debugging from the
menu bar
3. Press Shift + F5 on your keyboard
You can also click the Stop button
on the VB toolbars at the top, as in
the image below:
SAMPLE PROGRAM FOR VISUAL BASIC .NET
(VB .NET)
Public Class Form1
Inherits System.Windows.Forms.Form
[Windows Form Designer generated code]
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
MessageBox.Show("Hello World!")
End Sub
End Class

OUTPUT;
‘ HELLO WORLD ‘

Press F5 or go to the Debug menu and select Start to start the program.
You should see an alert box that says "Hello World!" and then the main
window (with nothing on it) should open. Click the "X" in the title bar like
you would to quit any program!
VISUAL BASIC .NET
CONTROLS
Visible Controls
Textboxes
A TextBox is used to get and display text. A TextBox can only
display text in one font, so it can't be used for word processing.
By default, a TextBox will only display text on a single line. If you
require more than one line you can set it's Multiline property to
true.

•Passwords
If you need a TextBox for accepting a password you should set it's PasswordChar
property to a character. The character you choose will be displayed in the
TextBox instead of what is actually typed. Good characters to choose include *
and ●.

•Clipboard
You can copy the selected text to the clipboard by using the TextBox.Copy
method. Use the TextBox.Paste method to paste text into the Textbox from the
Labels
Labels are used to display text. Unlike the textbox, it is not
meant to accept input from the user. Often a Label is used to
describe another control, and is often used as a prompt for a
Textbox.label display read-only text as far as the user is
concerned.
Buttons
Buttons are controls that are usually raised that the user most
often can click on to perform some action defined by the
programmer. Once the programmer has added the button
control to a form, he can define an event handler to perform an
action when the button is clicked.
Checkboxes
A check box indicates a two-way choice or state (true/false)
which can be edited by the user. Check boxes are shown on the
screen as a square box that can contain white space (for false)
or a check mark (for true). Adjacent to the check box is normally
shown a caption describing the meaning of the check box.
Inverting the state of a check box is done by clicking the mouse
Radio Buttons
A radio button allows the user to choose exactly one of a
predefined set of options. Radio buttons are arranged in groups
of two or more and displayed on screen a list of circular holes
that can contain white space (for unselected) or a dot (for
selected). Each radio button can show a caption describing the
choice that this radio button represents. This is done by setting
the radio button's text property.

RichTextBox
Can easily save Richtext files with Colours and Fonts. Has all the
qualities of a textbox but with built in save
method(richtextbox1.savefile(pathname)) and
openfile(Richtextbox1.openfile(filename)).
Other controls not visible at
design time
OpenFileDialog
An OpenFileDialog displays the standard "Open" dialog. It lets the
user browse for a file.
SaveFileDialog
A SaveFileDialog displays the standard "Save" dialog. It lets the user
browse for a directory to save files and enter a filename. It can
(optionally) automatically append extensions to the filename.
FontDialog
A FontDialog lets the user to select a font from a list of installed
fonts.
ColorDialog
A ColorDialog lets the user select predefined color or specify a
custom color.
Timer Control
A Timer Control is a control that will execute code at intervals. It is
not visible at runtime. The interval can be set in the properties in the
measurement of milliseconds. The timer control will continue to
Comparative Samples
The following simple example demonstrates similarity in syntax
between VB and VB.NET. Both examples pop up a message box
saying "Hello, World" with an OK button.

ClassicVB A VB.NET example:


example:
Public Class Form1
Private Sub
Button1_Click(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
Private Sub Button1.Click
Command1_Click() MessageBox.Show("Hello,
MsgBox "Hello, World" World")
End Sub End Sub
End Class
Obsolete Keywords, Functions, and Statements in VB .NET

Keyword, Function or Statement


§Array

•Circle, Line

§Currency
§MsgBox

§String
Keyword, Function or Statement

•Type

•String Functions

Variant

Disposition
New Keywords, Functions, and Statements in VB
.NET

Class
§IsArray

§Short, CShort

§^=, *=, /=, \=, +=, -=, &=

§MyClass
Class
§Namespace

§DirectCast

§IsReference

Disposition
END OF PRESENTATION
BY: aLjoN

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