Visual Basic Project Work
Visual Basic Project Work
1221783011103
INDEX
Page No Remark /
SN.o Projects Signature
Visual programming is based on the idea that humans process information better when it
is presented visually. By using visual elements like icons, diagrams, and flowcharts,
visual programming makes it easier for programmers to understand and manipulate
code. Visual programming languages are designed to be intuitive and user-friendly,
making them accessible to people with little or no programming experience.
Visual representation
VPLs use graphical elements like icons, flowcharts, and diagrams to create
programs, while traditional programming languages use lines of code.
Accessibility
VPLs are more accessible to beginners and non-programmers because they don't
require writing code from scratch.
Ease of use
Speed
VPLs can help programmers create complex programs more quickly and efficiently
by using pre-existing code blocks.
Debugging
VPLs make it easier to debug code because errors are often more visible in the
visual representation of the program.
Limited; suited for specific tasks or More flexible, suitable for general-purpose
Flexibility domains applications
PROS:
Easier Learning Curve: VPLs are accessible to beginners as they don’t require
memorizing complex syntax.
Rapid Prototyping: Visual programs are often quicker to prototype since users
can visualize the entire process.
Fewer Syntax Errors: Since users work with predefined blocks or visual
elements, syntax errors are minimized.
CONS:
Limited Flexibility: VPLs may not offer the same versatility as traditional
languages, especially for large-scale or specialized applications.
Scalability Issues: VPLs can become cluttered or difficult to manage for
very complex programs.
Performance Limitations: VPLs are often optimized for simplicity and may
lack the performance optimizations found in traditional languages.
2. Introduction of user interface / platform provided by VB6.0 with its
Different components and features
Menu Bar: The menu bar contains standard menu options like File, Edit, View,
Project, Tools, Run, Add-Ins, and Help Each menu provides access to different
features of the VB6
Toolbox: The toolbox holds a collection of controls and components that can be
dragged and dropped onto forms. These controls include elements like text boxes,
buttons, labels, checkboxes, combo boxes, and more.
Project Explorer: The Project Explorer displays all the forms, modules, classes, and
other objects within a project. It gives an organized view of the project structure.
Properties Window: The Properties Window allows the developer to modify the
properties of any selected control or object. This is where you can change the
appearance, behavior and other settings of a control, such as setting the text, font, or
alignment of a label.
Form Designer: The Form Designer is where you visually design the user interface of
your application by placing controls from the toolbox onto the form each form represents
a window in your application, and you can customize its look and feel by arranging controls
in this space
Form Layout Window: The Form Layout Window allows you to position forms in
relation to the screen It shows a visual representation of where the form will appear on
the screen when the application runs, helping you to position it accurately
Object Browser: The Object Browser provides a list of all available objects including their
properties, methods, and events) within the project and external libraries
Drag-and-Drop UI Design: Visual Basic 60 makes user interface design easy with its
drag- and-drop functionality Developers can simply drag controls from the toolbox and
drop them onto a form, streamlining the UI development process
Database Connectivity: VB6 has built-in support for database programming It can
connect to a wide range of databases such as Microsoft Access, SQL Server, and Oracle
through technologies like Data Access Objects DAO), Remote Data Objects RDO), and
ActiveX Data Objects ADO)
Built-in Debugger: The VB6 IDE comes with a built-in debugger that lets developers
pause the execution of *code*, set breakpoints, and step through the *code* line by line to
locate andfix bugs
Support for DLLs and External Libraries: Developers can create and use Dynamic
Link Libraries DLLs) in their VB6 applications
Menu Bar: It contains a standard command like: File, Edit, View, Window, Help menus,
and specific command such as: Project, Format, or Debug menus.
Project Explorer Window: The window titled Project-Project1 is called the Project
Explorer and contains the project files. The project explorer window’s tool bar contains
three buttons, namely view code, view object and toggle folders. When pressed, the view
code button displays a window for writing Visual Basic code. View object, when pressed,
displays the form. Double-clicking form1 (form1) also displays the form. The toggle folders
button toggles (i.e., alternately hides or shows) the forms folder. The forms folder contains
a listing of all forms in the current project. To show the Project Explorer window press
View> Project Explorer window icon.
Toolbar: It contains the most commonly used commands (button), if clicked an action
represented by that button is carried out.
Project Explorer Window: The window titled Project-Project1 is called the Project
Explorer and contains the project files. The project explorer window’s tool bar contains
three buttons, namely view code, view object and toggle folders. When pressed, the view
code button displays a window for writing Visual Basic code. View object, when pressed,
displays the form. Double-clicking form1 (form1) also displays the form. The toggle folders
button toggles (i.e., alternately hides or shows) the forms folder. The forms folder contains
a listing of all forms in the current project. To show the Project Explorer window press
View> Project Explorer window icon.
Properties Window: The properties window displays the properties for a form or
control. Properties are attributes such as size, position, etc. like a form; each control
type has its own set of properties. Some properties, like width and height, such as, are
common to both forms and controls, while other properties are unique to form or control.
Controls often differ in the number and type of properties. Properties are listed either
alphabetically (by selecting the alphabetic tab) or categorically (by selecting the
categorized tab). The most important properties of the objects in general are listed in
the following table. To show the properties window press View> properties window icon.
Properties Objective
name
Name Used to represent name
of object in code.
Caption Name appears on
object.
Back color Background color for
object.
Fore color Color of text written on
object.
Font Font style type and size
ToolBox: Contains a collection of tools that are needed for project design as shown in
figure below. To show the toolbox press View> toolbox icon. The user can place the tool
on form, and then work with the tool. To place the tool on form: click on tool>draw tool
to form > the tool appears on form or double click on tool then the tool appears on form.
Table summarizes the toolbox controls.
Control Description
Pointer Used to interact with controls on the form (resize them, move them, etc.). the
pointer is not a control
TextBox A control for accepting user input. Textbox can also display text.
CommandB A control that represents a button. The user presses or clicks to initiate an action.
utton
CheckBox A control that provides the user with a toggle choice (checked or unchecked)
OptionButto Option buttons are used in groups where only one at a time can be true.
n
ListBox A control that provides a list of items.
Timer A control that performs a task at programmer specified intervals. A timer is not
visible to the user.
Image A control for displaying images. The images control does not provide as many
capabilities as a picture box.
OLE A control for interacting with other window applications.
3. Define TextBox, CommandButton, OptionButton, CheckBox, ListBox
and ComboBox with their important properties, events and methods.
Property/
Method Description
Properties
Enabled Specifies whether user can interact with this control or not
If this control is set to True user can use it else if this control is set to
false the control cannot be used
Locked
MousePointer Using this we can set the shape of the mouse pointer when over a
TextBox
By setting this property to True user can have more than one line
in the TextBox
Multiline
Event procedures
Change Action happens when the TextBox changes
GotFocus Action happens when the TextBox receives the active focus
KeyDown Called when a key is pressed while the TextBox has the focus
KeyUp Called when a key is released while the TextBox has the focus
Example:
In this application, two text boxes are inserted into the form together with a few labels.
The two text boxes are used to accept inputs from the user and one of the labels will be
used to display the sum of two numbers that are entered into the two text boxes.
Besides, a command button is also programmed to calculate the sum of the two numbers
using the plus operator. The program use creates a variable sum to accept the
summation of values from text box 1 and text box 2. The procedure to calculate and to
display the output on the label is shown below.
The command button is one of the most important controls as it is used to execute
commands. It displays an illusion that the button is pressed when the user clicks on it.
The most common event associated with the command button is the Click event, and
the syntax for the procedure is
The Caption property determines the text to display on the face of the button. The
Default property, if set to true, means that the button will be activated (same as Clicked)
if the <Enter> key is hit anywhere in the form. If Cancel is set to True, the button will be
activated from anywhere in the form by the <Esc> key.
Properties Methods Events
Appearance, BackColor, Drag, Move, Click,
Cancel, Caption, Refresh, DragDrop,
Container, Default, SetFocus, DragOver,
DragIcon, DragMode, ShowWhatsThis, GotFocus,
Enabled, Font, ZOrder KeyDown,
FontBold, FontItalic, KeyPress,
FontName, FontSize, KeyUp,
FontStrikethru, LostFocus,
FontUnderline, Height, MouseDown,
HelpContextID, Index, MouseMove,
Left, MouseIcon,
MousePointer, Name,
Parent, Style, TabIndex,
TabStop, Tag, Top,
Value, Visible,
WhatsThisHelpID,
Width
Example:
We want to crack a secret password entered by the user. In the design phase, insert a
command button. Next, insert a TextBox and delete Text1 from the Text property.
Besides that, set its PasswordChr to *. Now, enter the following code in the code
window.
Run the program and enter a password, then click on the Show Password button to
reveal the password, as shown in Figure
THE CHECKBOX
The Check Box control lets the user selects or unselects an option. When the Check Box
is checked, its value is set to 1 and when it is unchecked, the value is set to 0. You can
include the statements [Link]=1 to mark the Check Box and [Link]=0 to
unmark the Check Box, as well as use them to initiate certain actions. In checkbox user
can select more than one option. Multiple selections are allowed in checkbox.
Properties Methods Events
Alignment, Appearance, BackColor, Caption, Drag, Move, Click, DragDrop,
Container, DataChanged, DataField, Refresh, DragOver, GotFocus,
DataSource, DragIcon, DragMode, Enabled, SetFocus, KeyDown, KeyPress,
Font, FontBold, FontItalic, FontName, ShowWhatsThis, KeyUp, LostFocus,
FontSize, FontStrikethru, FontUnderline, ZOrder MouseDown,
ForeColor, Height, HelpContextID, hWnd, MouseMove,
Index, Left, MousePointer, Name, Parent, MouseUp
TabIndex, TabStop, Tag, Top, Value, Visible,
WhatsThisHelpID, Width
Example:
In this application will show which items are selected in a message box.
Output :-
OPTION BUTTON
OptionButton controls are also known as radio buttons because of their shape. You always
use OptionButton controls in a group of two or more because their purpose is to offer a number
of mutually exclusive choices. Anytime you click on a button in the group, it switches to a
selected state and all the other controls in the group become unselected. Its value is set to
“True” and when it is unselected; its value is set to “False”.
Simple combo
The Simple Combo box displays an edit area with an attached list box always visible
immediately below the edit area. A simple combo box displays the contents of its list all the
time. The user can select an item from the list or type an item in the edit box portion of the
combo box. A scroll bar is displayed beside the list if there are too many items to be displayed
in the list box area.
Properties
By setting this property to True or False user can decide whether usercan
Enabled interact with this control or not
Locked Boolean. Specifies whether user can type or not in the ComboBox
Integer. Specifies the shape of the mouse pointer when over the area of
MousePointer the ComboBox
Sorted Boolean. Specifies whether the ComboBox's items are sorted or not.
ToolTipIndex String. Specifies what text is displayed as the ComboBox's tool tip
Methods
Event Procedures
ListBox have list property contain list or item to display. To add the item at design time,
click on list property & add item, press ctrl + enter after adding each item. To add item at
runtime to AddItem method is used.
Property/Method Description
Properties
Enabled By setting this property to True or False user can decide whether usercan
interact with this control or not
List String array. Contains the strings displayed in the drop-down list.
Starting array index is 0.
ListIndex Integer Contains the index of the selected ListBox items. If an item isnot
selected, ListIndex is -1
Locked Boolean. Specifies whether user can type or not in the ListBox
MousePointer [Link] the shape of the mouse pointer when over the area of
the ListBox
NewIndex Integer. Index of the last item added to the ListBox. If the ListBoxdoes
not contain any items, NewIndex is -1
Sorted Boolean. Specifies whether the ListBox's items are sorted or not.
ToolTipIndex String. Specifies what text is displayed as the ListBox's tool tip
Methods
6. Entity Framework EF
An ORM Object Relational Mapping) framework for NET, which allows
developers to work with databases using NET objects
1. AddNew)
This method is used to add a new, empty record to the RecordSet You can
then populate the fields and save the changes
Example:-
rsAddNew rs"FieldName") = "Value"
rsUpdate
2. Update)
After modifying the fields of the current record, the Update method saves the
changes to the database
Example:-
rs"FieldName") = "NewValue" rsUpdate
3. Delete)
Example:-
rsDelete
4. MoveNext)
Example:-
rsMoveNext
5. Close)
Example:-
rsClose
5. Write down different types of Database Connectivity’s and five methods of
Recordset.
CODING:-
Dim Fvalue, Svalue As Integer Dim op As String
Private Sub
cmdClear_Click()
[Link] =
"0"
End Sub
Private Sub
cmdDiv_Click()
op = "/"
InputData
End Sub
Private Sub
cmdModulo_Click()
op = "Mod"
InputData
End Sub
Private Sub
cmdMul_Click()
op = "*"
InputData
End Sub
Private Sub
cmdSub_Click()
op = "-"
InputData
End Sub
Private Sub
cmdSum_Click()
op = "+"
InputData
End Sub
End Sub
Else
[Link] = False
End If
End Sub
Private Sub chkUnderline_Click()
If [Link] = 1 Then
[Link] = True
Else
Private Sub
lstFont_Click() [Link] = [Link]
End Sub
End Select
If [Link] = "Bold" Then
[Link] = True
[Link] = False
ElseIf [Link] = "Oblique"
Else
[Link] = "*"
End If
End Sub
End If
End Sub
Private Sub
lblRefresh_Click()
RefreshCaptcha
End Sub
Private Sub
Form_Load()
Call
RefreshCaptcha
End Sub
End Sub
9. Design a Registration Form dialog window
CODING:-
txtAadhaarNumberrEnabled = False
End If
End Sub
txtAadhaarNumberrEnabled = True
End If
End Sub
*INPUT*
*OUTPUT*
10. Design a Table Create Using Looping) dialog window.
CODING:-
Dim i As Integer
*INPUT*
*OUTPUT*
11. Design a Traffic Light dialog window.
CODING:-
Private Sub Timer1_Timer()
Static change As Integer
change = change + 1
If change = 1 Then
RedFillColor = &HFF&
YellowFillColor = &H80000003
GreenFillColor = &H80000003
lblStatusCaption = "Stop"
lblStatusForeColor = &HFF&
lblStopVisible = True
lblreadyVisible = False
lblgoVisible = False
ElseIf change = 2 Then
RedFillColor = &H80000003
YellowFillColor = &HFFFF&
GreenFillColor = &H80000003
lblStatusCaption = "Ready"
lblStatusForeColor = &HFFFF&
lblStopVisible = False
lblreadyVisible = True
lblgoVisible = False
ElseIf change = 3 Then
RedFillColor = &H80000003
YellowFillColor = &H80000003
GreenFillColor = &HFF00&
lblStatusCaption = "Go"
lblStatusForeColor = &HFF00&
lblStopVisible = False
lblreadyVisible = False
lblgoVisible = True change = 0
End If
End Sub
*OUTPUT*
[Link] a Marquee Text dialog window.
CODING:-
Dim Click As String
Else:
[Link] = "Move Bottom To Top" [Link] = [Link] - 1000
If [Link] <= 0 Then
Direction = 0
End If
End If
Else:
[Link] = [Link] + 2000 [Link] = [Link] - 1000
If [Link] > [Link] - [Link] Or [Link] <= 0 Then
Direction = 0
End If
End If
*OUTPUT*
13. Design a costume Color Using scrollbar) dialog window.
CODING:-
Private Sub cmdPutBackcolor_Click()
[Link] = [Link]
End Sub
CODING:-
Dim LapCount As Integer
Dim MiliSec As Integer
Dim Sec As Integer
Dim Min As Integer
*INPUT*
*OUTPUT*
15. Design a Dilog Window to Open Picture in Picture-box.
CODING:-
Dim strfullpath As String
Private Sub
dirselect_Change)
fleselectPath =
dirselectPath updatepath
End Sub
picdisplayScaleMode = 3
picdisplayAutoRedraw = True
picdisplayPaintPicture picdisplayPicture, 0, 0, picdisplayScaleWidth, picdisplayScaleHeight,
0, 0, picdisplayPictureWidth / 2646, picdisplayPictureHeight / 2646 picdisplayPicture =
picdisplayImage
End Sub
*OUTPUT*
16. Design a dialog window to Student Information system.
Student Registration
CODING:-
Private Sub cmdsubmit_Click()
MsgBox "SUBMITED SUCESSESFULLY", vbInformation, ""
[Link]
End Sub
End Sub
End Sub
Private Sub optnoo_Click() If
optnoo = True Then
[Link] =
False
End If
End Sub
*OUTPUT*
Course Master
CODING:-
Private Sub add_Click()
[Link]
[Link] = ""
[Link] = ""
[Link] = ""
[Link] = ""
[Link] = ""
End Sub
CODING:-
Public coursecode As String
Public semester As String
Private Sub add_Click()
[Link]
End Sub
Private Sub
cbosubject_Click() If
[Link] = "Maths"
Then [Link] =
"BCA103" [Link]
= "Practical" [Link]
= "55"
ElseIf [Link] = "Visual
Basic" Then [Link] =
"BCA304" [Link] =
"Practical" [Link] = "80"
End If
End Sub
*OUTPUT*
Accounting
CODING:-
Private Sub cmdFetch_Click()
Dim cn As [Link]
Dim rs As [Link]
Set cn = New
[Link] Dim
roll_no As String roll_no
= txtRoll_No.Text
Set rs = New [Link]
[Link] "Select
course_code,total_fees,fees_paid,payment_date,panding_fees,late_fee_fine,oth
er_fine from feesaccounting where roll_number = '" & roll_no & "'", cn,
adOpenStatic If Not [Link] Then [Link] = rs!course_code [Link] =
rs!total_fees [Link] = rs!fees_paid [Link] = rs!payment_date
[Link] = rs!panding_fees [Link] = rs!late_fee_fine [Link] =
rs!other_fine
End If
End Sub
Private Sub Form_Load()
[Link]="Provider=[Link].4.0;Data
Source=E:\[Link];"
[Link] = "Select * From feesaccounting"
[Link]
Set [Link] = Adodc1
End Sub
*OUTPUT*