NAME:-Mohd Majid
CLASS: - B.Sc III
BATCH: - M2
Create Visual Basic Application Using Application Wizard.
This is the first window when you start Application Wizard from new Projects Window
After Clicking on next button On Introductions Wizards the window is appearing as above.
You have to choose different menu & submenu for menu bar from above Menu window
You can also select the toolbar option from the wizards as shown in above window.
After completing the application wizards the above Application Created dialog box is appeared.
This is use of application wizards on form or Application as shown in above figure
Private Sub Command1_Click()
Text3.Text = Val(Text1.Text) + Val(Text2.Text)
Label3.Caption = "SUM"
End Sub
Private Sub Command2_Click()
Text3.Text = Val(Text1.Text) - Val(Text2.Text)
Label3.Caption = "SUB"
End Sub
Private Sub Command3_Click()
Text3.Text = Val(Text1.Text) * Val(Text2.Text)
Label3.Caption = "MUL"
End Sub
Private Sub Command4_Click()
On Error Resume Next
If Val(Text2.Text) = 0 Then
If MsgBox("Enter the value is greater than ZERO in No.2", vbCritical + vbOKOnly,
"Zero") = vbOK Then
Text2.SetFocus
End If
End If
Text3.Text = Val(Text1.Text) / Val(Text2.Text)
Label3.Caption = "DIV"
End Sub
Private Sub Command5_Click()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Label3.Caption = "Result"
Text1.SetFocus
End Sub
Private Sub Command6_Click()
Unload Me
End Sub
Dim n(0 To 10) As Integer
Dim i, avg, sum As Integer
Private Sub cmdaccept_Click()
n(i) = CInt(txtnum.Text)
sum = sum + n(i)
txtnum.Text = ""
i=i+1
txtnum.SetFocus
End Sub
Private Sub cmddisplay_Click()
If (sum = 0) Then
MsgBox " No Number Is Entered ....", vbCritical, "Entry"
Else
avg = sum / i
txtavg.Text = avg
txtdisplay.Text = n(0) & " , " & n(1) & " , " & n(2) & " , " & n(3) & " , " & n(4) & " , " & n(5) & " , "
& n(6) & " , " & n(7) & " , " & n(8) & " , " & n(9)
cmdaccept.Enabled = False
txtnum.Enabled = False
End If
End Sub
Private Sub cmdexit_Click()
End
End Sub
Private Sub cmdclear_Click()
txtnum.Text = ""
txtavg = ""
txtdisplay.Text = ""
i=0
avg = 0
sum = 0
txtnum.Enabled = True
cmdaccept.Enabled = True
cmddisplay.Enabled = True
End Sub
Private Sub Form_Load()
i=0
avg = 0
sum = 0
End Sub
Private Sub chkmov_Click()
result
End Sub
Private Sub chkplay_Click()
result
End Sub
Private Sub chkread_Click()
result
End Sub
Private Sub chkwrite_Click()
result
End Sub
Private Sub Form_Load()
txtresult.Text = "Your selected category is: OBC"
End Sub
Private Sub optobc_Click()
result
End Sub
Private Sub optopen_Click()
result
End Sub
Private Sub optother_Click()
result
End Sub
Private Sub optsc_Click()
result
End Sub
Private Sub result()
If optobc.Value = True Then
txtresult.Text = "Your selected category is : " & optobc.Caption & vbCrLf
ElseIf optopen.Value = True Then
txtresult.Text = "Your selected category is : " & optopen.Caption & vbCrLf
ElseIf optsc.Value = True Then
txtresult.Text = "Your selected category is : " & optsc.Caption & vbCrLf
ElseIf optother.Value = True Then
txtresult.Text = "Your selected category is : " & optother.Caption & vbCrLf
End If
If chkread.Value = 1 Or chkwrite.Value = 1 Or chkplay.Value = 1 Or chkmov.Value = 1 Then
txtresult.Text = txtresult.Text & "Your selected hobbies are : " & vbCrLf
End If
If chkread.Value = 1 Then
txtresult.Text = txtresult.Text & chkread.Caption & vbCrLf
End If
If chkwrite.Value = 1 Then
txtresult.Text = txtresult.Text & chkwrite.Caption & vbCrLf
End If
If chkplay.Value = 1 Then
txtresult.Text = txtresult.Text & chkplay.Caption & vbCrLf
End If
If chkmov.Value = 1 Then
txtresult.Text = txtresult.Text & chkmov.Caption & vbCrLf
End If
End Sub
Private Sub cmdclear_Click()
txtfarenheite.Text = ""
txtcelcius.Text = ""
End Sub
Private Sub cmdexit_Click()
Unload Me
End Sub
Private Sub cmdok_Click()
Dim c As Integer
Dim f As Double
c = Val(txtcelcius.Text)
f = Val(txtfarenheite.Text)
c = (f - 32) * 5 / 9
txtcelcius.Text = c
End Sub
EXPERIMENT NO
NAME:-Mohd Majid
CLASS: - B.Sc III
BATCH: - M2
Create Visual Basic Application Which Uses Input Box ( ) function.
Form1
Form 2
Form 3
Visual Basic Code:-
Dim fname, mname, lname As String
Private Sub cmdfname_Click()
fname = InputBox ("Enter Your First Name :", "First Name")
End Sub
Private Sub cmdfull_Click()
MsgBox "Your Full Name Is :- " & fname & " " & mname & " " & lname,
vbOKCancel + vbQuestion, "Full Name"
End Sub
Private Sub cmdlname_Click()
lname = InputBox("Enter Your Last Name :", "Last Name")
End Sub
Private Sub cndmname_Click()
mname = InputBox("Enter Your Middle Name :", "Middle Name")
End Sub
NAME:-Mohd Majid
CLASS: - B.Sc III
BATCH: - M2
DATE:-20-01-2008
Create Visual Basic Application To Find Greatest Among Three
Numbers.
Form 1
Form 2
Visual Basic Code
Private Sub cmdClear_Click()
txtNum1.Text = ""
txtNum2.Text = ""
txtNum3.Text = ""
txtLargest.Text = ""
End Sub
Private Sub cmdExit_Click()
Unload Me
End Sub
Private Sub cmdOk_Click()
Dim A, B, C As Integer
A = CInt(txtNum1.Text)
B = CInt(txtNum2.Text)
C = CInt(txtNum3.Text)
If A > B And A > C Then
txtLargest.Text = A
ElseIf B > C Then
txtLargest.Text = B
Else
txtLargest.Text = C
End If
End Sub
EXPERIMENT NO-
NAME:- Mohd Majid
CLASS:- B.S.c III
BATCH :- CES
Create VB Application which Demonstrate the List Box.
STARTING FORM
OUTPUT
CODES
Private Sub cmdclear_Click()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text1.SetFocus
End Sub
Private Sub cmdlstok_Click()
If listopt.ListIndex = 0 Then
Text3.Text = Val(Text1.Text) + Val(Text2.Text)
Label3.Caption = "SUM"
ElseIf listopt.ListIndex = 1 Then
Text3.Text = Val(Text1.Text) - Val(Text2.Text)
Label3.Caption = "SUB"
ElseIf listopt.ListIndex = 2 Then
Text3.Text = Val(Text1.Text) * Val(Text2.Text)
Label3.Caption = "MUL"
ElseIf listopt.ListIndex = 3 Then
Text3.Text = Val(Text1.Text) / Val(Text2.Text)
Label3.Caption = "DIV"
ElseIf listopt.ListIndex = 4 Then
Text1.Text = " "
Text2.Text = " "
Text3.Text = " "
Text1.SetFocus
Label3.Caption = "Result"
ElseIf listopt.ListIndex = 5 Then
Unload Me
End If
End Sub
NAME:-Mohd Majid
CLASS: - B.Sc III
BATCH: - M2
Create Visual Basic Application for Mark list of Student.
Form window
Output Window
Visual Basic Code
Dim intTotal As Integer
Dim dblPercentage As Double
Private Sub cmdok_Click()
txttotal.Text = (CInt(txtmar.Text) + CInt(txthin.Text) + CInt(txteng.Text) +
CInt(txtmaths.Text) + CInt(txtsci.Text) + CInt(txtssci.Text))
intTotal = (txttotal.Text)
dblPercentage = (intTotal / 7.5)
lblpercentage.Caption = dblPercentage & " %"
If (CInt(txtmar.Text) < 35) Or (CInt(txthin.Text) < 35) Or (CInt(txteng.Text) < 35) Or
(CInt(txtmaths.Text) < 52) Or (CInt(txtsci.Text) < 52) Or (CInt(txtssci.Text) < 52) Then
lblresult.Caption = " Fail "
Else
lblresult.Caption = "Pass "
End If
If (dblPercentage > 75) Or (dblPercentage = 75) Then
lblgrade.Caption = " Distinction "
ElseIf (dblPercentage > 60) Or (dblPercentage = 60) Then
lblgrade.Caption = " I Class "
ElseIf (dblPercentage > 45) Or (dblPercentage = 45) Then
lblgrade.Caption = " II Class "
End If
End Sub
Private Sub Command1_Click()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
txtmar.Text = ""
txthin.Text = ""
txteng.Text = ""
txtmaths.Text = ""
txtsci.Text = ""
txtssci.Text = ""
txttotal.Text = ""
Text16.Text = ""
Text17.Text = ""
Text18.Text = ""
Text19.Text = ""
Text20.Text = ""
Text21.Text = ""
lblpercentage.Caption = "....."
lblresult.Caption = "....."
lblgrade.Caption = "....."
End Sub
EXPERIMENT NO
NAME:Mohd Majid
CLASS: - B.Sc III
BATCH: - M2
Create Visual Basic Application Which Uses the menu editor to full function menu
Form1
Form2
Output form 3
Output form 4
Output form 5
Visual Basic Code Of Programme
Private Sub MnuAboutUs_Click()
MsgBox "College Vb Software 1.0 version", vbOKOnly + vbInformation, "About
Product"
End Sub
Private Sub mnuColorBlue_Click ()
lblname1.ForeColor = vbBlue
lblname2.ForeColor = vbBlue
MnuColorBlue.Checked = True
MnuColorRed.Checked = False
MnuColorGreen.Checked = False
End Sub
Private Sub MnuColorGreen_Click ()
lblname1.ForeColor = vbGreen
lblname2.ForeColor = vbGreen
MnuColorBlue.Checked = False
MnuColorRed.Checked = False
MnuColorGreen.Checked = True
End Sub
Private Sub MnuColorRed_Click ()
lblname1.ForeColor = vbRed
lblname2.ForeColor = vbRed
MnuColorBlue.Checked = False
MnuColorRed.Checked = True
MnuColorGreen.Checked = False
End Sub
Private Sub mnuFileExit_Click ()
End
End Sub
Private Sub mnuFormatBold_Click ()
lblname1.FontBold = True
lblname2.FontBold = True
lblname1.FontItalic = False
lblname2.FontItalic = False
mnuFormatIttalic.Checked = False
mnuFormatBold.Checked = True
End Sub
Private Sub mnuFormatIttalic_Click()
lblname1.FontItalic = True
lblname2.FontItalic = True
lblname1.FontBold = False
lblname2.FontBold = False
mnuFormatIttalic.Checked = True
mnuFormatBold.Checked = False
End Sub
Private Sub cmdclear_Click()
txtmile.Text = ""
txtcenti.Text = ""
End Sub
Private Sub cmdconvert_Click()
txtcenti.Text = CInt(txtmile.Text) * 160934.4 & " CM "
End Sub
Private Sub cmdexit_Click()
Unload Me
End Sub
NAME:-Mohd Majid
CLASS: - B.Sc III
BATCH: - M2
DATE:-20-01-2008
Create Visual Basic Application Which Uses A Text Box To Display Mouse
Status When You Move Or Click A Mouse
Form 1
Form 2
Form 3
Visual Basic Code
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
txtPositionX.Text = X
txtPositionY.Text = Y
End Sub
NAME:-Mohd Majid
CLASS: - B.Sc III
BATCH: - M2
DATE:-20-01-2008
Create Visual Basic Application Using Magbox ( ) Function.
Form 1
Form 2
Form 3
Visual Basic Code
Dim n As Integer
Private Sub cmdlogin_Click ()
n=n+1
If (txtlogin.Text = "JAY GAJANAN") Then
MsgBox "CONGRAGULATION YOU CAN ACCESS THE SYSTEM",
vbOKOnly + vbExclamation, "WELCOME"
ElseIf (n < 3) Then
MsgBox "ENTER THE PASSWORD CORRECTLY ", vbOKOnly +
vbExclamation, "WELCOME"
txtlogin.Text = ""
Else
MsgBox "CONTACT YOUR ADMISTATOR YOU ARE NOT AUTHORISED
USER ", vbOKOnly + vbExclamation, "WRONG ACCESS"
Unload Me
End If
End Sub
Private Sub Form_Load()
n=0
End Sub
EXPERIMENT NO :-
EXPERIMENT :- Create Visual Basic Application To Find Number Of
Digit In given Digit.
NAME : - MOHD MAJID
CLASS : - B.Sc III
BATCH : - CEP
Private Sub cmdclear_Click()
txtnumber.Text = ""
txtconvert.Text = ""
End Sub
Private Sub cmdconvert_Click()
txtconvert.Text = Len(txtnumber.Text)
End Sub
Private Sub cmdexit_Click()
Unload Me
End Sub
EXPERIMENT NO :-
EXPERIMENT :- Create Visual Basic Application Using Option Button
NAME:-MOHD MAJID
CLASS: - B.Sc III
BATCH: - CEP
Private Sub chkbold_Click()
result1
End Sub
Private Sub chkita_Click()
result1
End Sub
Private Sub chkun_Click()
result1
End Sub
Private Sub Form_Load()
txtresult.Text = " THIS IS VISUAL BASIC EXPERIMENT USING OPTION & CHECH BOX "
End Sub
Private Sub optblue_Click()
result1
End Sub
Private Sub optgreen_Click()
result1
End Sub
Private Sub optred_Click()
result1
End Sub
Private Sub optyello_Click()
result1
End Sub
Private Sub result1()
If optyello.Value = True Then
txtresult.ForeColor = vbYellow
Else
If optgreen.Value = True Then
txtresult.ForeColor = vbGreen
Else
If optblue.Value = True Then
txtresult.ForeColor = vbBlue
Else
If optred.Value = True Then
txtresult.ForeColor = vbRed
End If
End If
End If
End If
If chkita.Value = 1 Then
txtresult.FontItalic = True
Else
txtresult.FontItalic = False
End If
If chkbold.Value = 1 Then
txtresult.FontBold = True
Else
txtresult.FontBold = False
End If
If chkun.Value = 1 Then
txtresult.FontUnderline = True
Else
txtresult.FontUnderline = False
End If
End Sub
EXPERIMENT NO :-
EXPERIMENT:- Create Visual Basic Application Which Uses a text box property to
request a password and display a graphical image after entering password successful.
NAME:-MOHD MAJID
CLASS: - B.Sc III
BATCH: - CEP
STARTING FORM 1
FORM WITH WRONG PASSWORD
FORM WITH CORRECT PASSWORD
CODE WINDOW :-
Dim n As Integer
Private Sub cmdok_Click ()
n=n+1
If (txtlogin.Text = "SHIVAJI AKOLA") Then
MsgBox "You Can Login the System", vbOKOnly + vbInformation, "LOGIN
SUCCESFULL"
img1.Visible = True
Unload Me
Else If (n < 3) Then
MsgBox "Enter the Correct Password ", vbOKOnly + vbInformation, "LOGIN
FAILED"
txtlogin.Text = ""
Else
MsgBox "Contact Your Adminstrator", vbOKOnly + vbCritical, "Admistrator"
End
End If
End Sub
Private Sub Form_Load ()
img1.Visible = False
n=0
End Sub
EXPERIMENT NO:-
PROGRAME: - Programe For Visual Basic Application Which Changes The Picture when
You Click On Command Button.
NAME :- MOHD MAJID
CLASS :- B.Sc III
BATCH :- CEP
Form 1
Output Form 1
Output form 2
Output Form To Quite Window
Visual Basic Code
Dim i, r, g, b As Integer
Private Sub cmdok_Click()
Form1.Height = 5430
Form1.Width = 8070
pb1 = imglst.ListImages.Count
r = Rnd * 255
g = Rnd * 255
b = Rnd * 255
i=i+1
If i > imglst.ListImages.Count Then
MsgBox "Slide Show Is Completed"
Timer1.Enabled = False
Else
Image1.Picture = imglst.ListImages(i).Picture
Me.BackColor = RGB(r, g, b)
End If
End Sub
Private Sub Command1_Click()
Unload Me
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
Dim reply As Integer
reply = MsgBox("DO You Want To Quite ?.... ", vbYesNo + vbCritical, "Exit Window")
If reply = vbYes Then
Unload Me
ElseIf reply = vbNo Then
Cancel = True
End If
End Sub
EXPERIMENT NO:-
PROGRAME :- PROGRME FOR REVERSE OF GIVEN NO.
NAME :- MOHD MAJID
CLASS :- B.Sc III
BATCH :- CEP
Private Sub cmdclear_Click()
txtno.Text = ""
txtreverse.Text = ""
End Sub
Private Sub cmdexit_Click()
Unload Me
End Sub
Private Sub cmdreverse_Click()
Dim n, r As Integer
n = Val(txtno.Text)
Do
r = n Mod 10
txtreverse.Text = txtreverse.Text & r
n = n \ 10
Loop Until n = 0
End Sub
EXPERIMENT NO:- 01
PROGRAME :- PROGRME FOR SIMPLE VB DOCUMENT
NAME :- MOHD MAJID
CLASS :- B.Sc III
BATCH :- CEP
Private Sub cmdok_Click()
lblname.Visible = True
End Sub
Private Sub Command2_Click()
lblname.Caption = ""
End Sub
Private Sub Command3_Click()
Unload Me
End Sub
Private Sub Form_Load()
lblname.Visible = False
End Sub
EXPERIMENT NO :-
EXPERIMENT:- Create Visual Basic Application Using Tool from toolbox.
NAME:-MOHD MAJID
CLASS: - B.Sc III
BATCH: - CEP
Form 1
Form 2
Form 3
Form 4
VISUAL BASIC CODE
Private Sub MDIForm_Load()
Toolbar1.Buttons.Item(1).Enabled = False
Toolbar1.Buttons.Item(2).Enabled = False
Toolbar1.Buttons.Item(3).Enabled = False
End Sub
Private Sub MnuFileExit_Click()
Unload Me
End Sub
Private Sub MnuFileForm4_Click()
Toolbar1.Buttons.Item(1).Enabled = True
Toolbar1.Buttons.Item(2).Enabled = True
Toolbar1.Buttons.Item(3).Enabled = True
Form4.Show
End Sub
Private Sub MnuFileNew_Click()
Form4.Height = 5430
Form4.Width = 8025
Toolbar1.Buttons.Item(1).Enabled = True
Toolbar1.Buttons.Item(2).Enabled = True
Toolbar1.Buttons.Item(3).Enabled = True
End Sub
Private Sub MnuFileOpenOther_Click()
cd1.ShowOpen
End Sub
Private Sub MnuFileSave_Click()
cd1.ShowSave
MDIForm1.Caption = cd1.FileName
End Sub
Private Sub MnuHelpAboutUs_Click()
MsgBox " shivaji akola software limited .....", vbInformation, "About Us"
End Sub
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
Select Case Button.Index()
Case 1: VB.Clipboard.SetText Form4.RTB1.SelText
Form4.RTB1.SelText = ""
Case 2: VB.Clipboard.SetText Form4.RTB1.SelText
Case 3: Form4.RTB1.SelText = VB.Clipboard.GetText
Case 5:
If Toolbar1.Buttons(5).Value = tbrUnpressed Then
Form4.RTB1.Font.Bold = False
Else
Form4.RTB1.Font.Bold = True
End If
Case 6:
If Toolbar1.Buttons(6).Value = tbrUnpressed Then
Form4.RTB1.Font.Italic = False
Else
Form4.RTB1.Font.Italic = True
End If
Case 7:
If Toolbar1.Buttons(7).Value = tbrUnpressed Then
Form4.RTB1.Font.Underline = False
Else
Form4.RTB1.Font.Underline = True
End If
End Select
End Sub
Private Sub Toolbar1_ButtonMenuClick(ByVal ButtonMenu As
MSComctlLib.ButtonMenu)
Form4.RTB1.FontSize = ButtonMenu.Text
End Sub