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

module 3

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1/ 23

Writing Visual Basic Projects

Three steps in creating VB project are: design the user


interface, set the properties and write the basic code.
Design the user interface: when you plan the user interface,
you draw a sketch of the screens the user will see when
running your project. On your sketch, show the forms and all
the controls that you plan to use indicate the names that you
plan to give the form and each of the objects on the form.
Set the properties: writing down the properties that you plan to
set or change during the design of the form, you give each
object a name and define such attributes as the contents of a
label, the size of the text.
Write the Basic code: plan the procedures that will execute
when your projects runs, you will use basic code to carry out
the actions needed by your program.
Three types of VB mode
VB has three distinct modes in changing property settings: Design time, Run
Time and Break Time.
Design time is when you’re designing or drawing your user interface and
writing code but before you actually run your program. Design time is when the
program is developed, the interface is created, and the code is written. In design
time, a developer can add, delete, and modify code and make changes to the
program settings.
Runtime is when you are testing and running your project. it is when the
program is running. At runtime, the program is running, and changes to the
program’s design and code cannot be made. However, a programmer can write
directions during design time that will change how a program looks and works
in runtime. It is important to remember that at design time a developer decides
everything that a program will be and can do. At runtime, the program executes
the commands given to it at design time.
Break time is when you get a runtime error and pause execution you are in
break time.
Steps to take in designing user interface: Create a form, Choose the object you
want to draw from the toolbox, Draw the object on the form and write basic code.

Reserved keywords include Loop, If, Then, For, Select, End, Sub, Case, Function,
Integer, Else, Do, And, AndAlso, As, Boolean, ByRef, Byte, ByVal, Case, Cbool,
Cchar, Cdec, char, Cint, Cshort, CLng, CSng, CStr, Ctype, Decimal, Declare, Dim,
Do, Double, Each, Else, ElseIf, End, End If, Error, Event, Explicit, False, For, Get,
GetType, GoTo, If, Imports, Input, Integer, Is, Like, Long, Module, Mod, MyClass,
On, Off, OrElse, Private, Property, Public, Read, ReadOnly, Return, Short, Single,
Static, Step, Stop, Sub, Then, To, TypeOf, While
Subprograms in VB are known as Event Procedures/ Subroutines.
Procedures tells each object on your form how to react to something that the user
does.
F4 is to display property window, F5 to run VB, F7 to display code window. VB
stores the name of the object in a list called the Object list.
The common elements of a VB user interface include Forms known as windows, buttons such
as Command Button and Radio Buttons. Boxes such as Textboxes and CheckBoxes, Label,
Pictures as Icons and Graphics. Pointer is to select objects, Picture Box ( is to draw a box to
display graphics), Label (is to draw a box to display text), Textbox (is to draw a box that can
display text and let the user type in text). Frame( is to group 2 or more objects together).
Command Button( is to draw command button). Check Box(is to draw check box). Option or
radio button( is to draw radio button). Combo box (is to draw combo box) . List Box (is to draw
list box). Horizontal Scroll Bar (is to draw horizontal Scroll Bar). Vertical scroll bar (is to draw
vertical scroll bar). Timer is to place a timer on a form.
Lists of Standard window in VB
Code: shows the actual basic code behind a form.
Designer: is the view you’ll use to drag controls from the toolbox onto forms to build up
application’s user interface.
Database Explorer: show the tables stored procedures and other artifacts inside the
database.
Solution Explorer: shows all the files in the project. It shows every single project in the
solution and all the files in each project. It holds the filenames for the files included in
your project and a list of the classes it references.
Properties window: customize the look and feel and behaviour of the various
components of your program and its user interface. It is to set the properties for the
objects in your project. It is to customize those controls to give your application a
unique look and feel. Also, to provides options that relates to the code.
Toolbox: is a dynamic window in that its contents change based on what you are doing.
it holds the tools you use to place controls on a form. e.g all windows form, common
controls, menu and toolbar, data, component, printing, dialog, reporting, general.
Form designer: is where you design a form that makes up your user interface.
Toolbars: you can use the buttons on the toolbars as shortcuts for frequently used
operations. Each button represents a command that can also be selected from a menu.
Object Browser, Error List, Document Outline, Output, Tasklist, Start page, web Browser.
Opening New Dialog Box
Design View of Visual Basic
Starting Visual Studio.NET
Solution Explorer Windows
Toolbox windows
Properties windows
Creating New application
Creating Application
• Types of Applications
• Console Application – Usually Text only application. Runs from a DOS or
COMMAND PROMPT screen.
• Windows Application – Graphical Interface user application. Typical
Windows application that you normally use, such as MS WORD etc.
• Web Based Windows Application – Web application that uses a Browser
such as Internet Explorer, Mozilla Firefox, chrome etc.
Console Application
• A Console Application is a program whose output is usually text based
(No Graphics).
• Console Applications usually do not contain Forms or any graphics,
but they can. You can if you like from a console application call
Windows Forms etc.
• Console Applications are created when an application performs
processing that requires very or no user interaction.
• They are lighter and have less overhead than standard windows
applications since they contain no graphical libraries.
Console application contd
• Console applications are a good choice when creating programs such
as login scripts, device drivers, backend processes, test programs,
programs that control hardware devices etc.
• The results of a Console Application is placed or controlled from a
Command Prompt Window:
Console application contd
Windows Application
• Windows Applications are your standard graphical applications we are
used to using.
• Windows Apps use graphical entities such as Forms, Web Forms etc.
Windows Application contd
Web-Based Application
• These are applications created for the World-Wide-Web or Internet.
• These applications run from a Browser, but the actual program code
for these applications (HTML) reside on a Web
• Server and are distributed to any client or browser which makes the
request.
Web based application cont.
Creating VB.NETProject
• Steps in creating project
• Open the Visual Studio IDE and invoke the Start Page:
• In the Start Page, select New Project
• In the New Project Dialog select Application Type
• In the Project Types box select: “Visual Basic Projects”
• In the Template box select: “Windows Applications” or “Console Application”
• Enter the project name into the “Name:” text box
• Set the project path or location in the “Location:” text box. You can also
browse for the path using the “Browse” button.
• Click OK
Console Application
Main Screen for a Console
Application:

You might also like