0% found this document useful (0 votes)
4 views

VB Lab Full Programs Record

Uploaded by

Narenkumar. N
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

VB Lab Full Programs Record

Uploaded by

Narenkumar. N
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 50

EX NO: 1 BUILDING SIMPLE APPLICATION USING FORM

OBJECT
DATE: MARKSHEET PROCESSING

AIM:

PROCEDURE:
PROPERTY SETTINGS:

CONTROL NAME PROPERTY VALUE


Command1 Name cmdclc
Command2 Name cmdcln
Command button Command1 Caption calculate
Command2 Caption clear

Text1 Text
Text2 Text
Text3 Text
Text4 Text
Text5 Text
Text6 Text
Text7 Text
Textbox Text8 Text

Text1 Name Txtsub1


Text2 Name Txtsub2
Text3 Name Txtsub3
Text4 Name Txtsub4
Text5 Name Txtsub5
Text6 Name Txttot
Text7 Name Txtper
Text8 Name Txtgra
Marksheet
Label1 Caption Processing
Label2 Caption Tamil
Label3 Caption English
Label4 Caption Maths
Label5 Caption Science
Label Label6 Caption Social
Label7 Caption Total
Label8 Caption Percentage
Label9 Caption Grade
Label10 Caption Remarks
Label10 Name Lblrem
FORM DESIGN:
SOURCE CODE:
Private sub cmdclc_click()

Dim s1,s2,s3,s4,s5 As integer

Dim tot,per As double

Dim grade As string

Dim s As string

S1=val(txtsub1.text)

S2=val(txtsub2.text)

S3=val(txtsub3.text)

S4=val(txtsub4.text)

S5=val(txtsub5.text)

Tot=s1+s2+s3+s4+s5

Per=tot/5

Txttot.text=tot

Txtper.text=per

If s1>40 And s2>40 And s3>40 And s4>40 And s5>40 Then

Select case per

Case Is>90

Grade=”H”

Case Is>60

Grade=”A”

Case Is>50

Grade=”B”
Case Is>35

Grade=”C”

End select

Txtgra.text=grade

S=txtgra.text

Select case S

Case “H”

Lblrem.caption=”Excellent”

Case”A”

Lblrem.caption=”very good”

Case”B”

Lblrem.caption=”good”

Case”C”

Lblrem.caption=”Average”

End select

Else

Txtgra.text=”F”

Lblrem.caption=”Fail”

End If

End sub
Private sub cmdclr_click()

Txtsub1.text= “ ”

Txtsub2.text= “ ”

Txtsub3.text= “ ”
Txtsub4.text= “ ”

Txtsub5.text= “ ”

Txttot.text= “ ”
Txtper.text= “ ”

Txtgra.text= “ ”

Lblrem.caption=“ ”
End sub

Private sub form_load()

Txtgra.Enabled=False

End sub
OUTPUT:

RESULT:
EX NO: 2 WORKING WITH INTRINSIC CONTROLS
DATE: STUDENT INFORMATION SYSTEM

AIM:

PROCEDURE:
PROPERTY SETTINGS:

CONTROL NAME PROPERTY VALUE


Command1 Name cmdchk
Command2 Name cmdsave
Command3 Name cmdclear
Command4 Name cmdclose
Command button Command1 Caption Check Fields
Command2 Caption Save
Command3 Caption Clear
Command4 Caption Close
Text1 Text
Text2 Text
Text3 Text
Text4 Text
Text5 Text
Text6 Text
Text1 Name Txtname
Text2 Name Txtregno
Text3 Name Txtdob
Text4 Name Txtconnum
Text5 Name Txtfname
Text6 Name Txtadd
Text6 Scroll Bars 3-Both
TextBox Text6 MultiLine True
STUDENT
INFORMATION
Label1 Caption SYSTEM
Label2 Caption Name
Label3 Caption Registration
Number
Label4 Caption Date Of Birth
Label5 Caption Contact Number
Label Label6 Caption Father Name
Label7 Caption Address
Label8 Caption Year Appearing
Label9 Caption Course
Label10 Caption Major Subject
Frame Control Frame1 Caption Gender
Option1 Caption Male
Option1 Name opmale
Option2 Caption Female
Option Button Option2 Name opfemale
I Year
II Year
List Box1 List1 List III Year
List1 Name Listya
Combo1 Text
BCA
MCA
B.Com
M.Com
BBA
Combo1 List MBA
Combo1 Name Comcourse
Combo2 Text
Computer
Applications
Commercre
Business
Combo2 List Administration
Combo Box Combo2 Name Comms
FORM DESIGN:
SOURCE CODE:

Private Sub cmdchk_Click()

If (txtname.Text = " ") Then

MsgBox ("Enter Your Name")


End If

If (txtregno.Text = " ") Then

MsgBox ("Enter Your Registration Name")


End If

If (Txtdob.Text = " ") Then

MsgBox ("Enter Your Date of Birth")


End If
If (Txtconnum.Text = " ") Then

MsgBox ("Enter Your Contact Number")


End If
If (Txtfname.Text = " ") Then

MsgBox ("Enter Your Father Name")

End If
If (Txtadd.Text = " ") Then

MsgBox ("Enter Your Address")

End If
If (listya.Text = " ") Then

MsgBox ("Select the year you are appearing")

End If
If (Comcourse.Text = " ") Then

MsgBox ("Enter the course you are studying")

End If

If (Comms.Text = " ") Then


MsgBox ("Enter the Major Subject")

End If

MsgBox ("Save the Record")


End Sub

Private Sub cmdsave_Click()


MsgBox (" Record Saved Successfully")
End Sub

Private Sub cmdclear_Click()


txtname.Text = " "

txtregno.Text = " "

Txtdob.Text = " "


Txtconnum.Text = " "

Txtfname.Text = " "

Txtadd.Text = " "


opmale.Value = False

opfemale.Value = False

listya.Text = " "


Comcourse.Text = " "

Comms.Text = " "

End Sub

Private Sub cmdclose_Click()

End

End Sub
OUTPUT:

RESULT:
EX NO:3 APPLICATION WITH MENUS
DATE:

AIM:

PROCEDURE:
PROPERTY SETTINGS:

Tools Menu Editor

Caption Name ShortCut

&Background color Bg (None)

B&lack Color BC Ctrl+B

&Red Color RC Ctrl+R

Bl&ue Color BLC Ctrl+U

&Green Color GC Ctrl+G

&Cyan Color CC Ctrl+ C

&Yellow Color YC Ctrl+ Y

&Magenta Color MC Ctrl+M

&Close CLS Ctrl+E


FORM DESIGN:
SOURCE CODE:

Private Sub BC_Click()

Form1.BackColor = &H00000000&

MsgBox (" Its a Black Color")


End Sub

Private Sub BLC_Click()


Form1.BackColor = &HFF0000&

MsgBox (" Its a Blue Color")

End Sub

Private Sub CC_Click()

Form1.BackColor = &H00FFF00&
MsgBox (" Its a Light Blue Color")
End Sub

Private Sub CLS_Click()


Form1.BackColor= &H00FFFFFF&

MsgBox (" Do you want to Close the Form?")

End
End Sub

Private Sub GC_Click()

Form1.BackColor = &H0000FF00&
MsgBox (" Its a Green Color")

End Sub

Private Sub MC_Click()


Form1.BackColor = &H00FF00FF&

MsgBox (" Its a Magenta Color")

End Sub

Private Sub RC_Click()

Form1.BackColor = &H000000FF&
MsgBox (" Its a Red Color")
End Sub

Private Sub YC_Click()


Form1.BackColor = &H0000FFFF&

MsgBox (" Its a Yellow Color")

End Sub
OUTPUT:
RESULT:
EX NO:4 APPLICATION WITH MDI
DATE:

AIM:

PROCEDURE:
PROPERTY SETTINGS:

Project Add MDI Form

Control Property Value

Form1 Name Form1

Form1 MDI Child True

Text1 Name txtcolor

Text1 Text

Microsoft Common
Dialog Control 6.0

Tools Menu Editor

Caption Name ShortCut

Fonts Fonts (None)

ForeColor Forecolor (None)

BackColor BackColor (None)

Exit Exit (None)


FORM DESIGN:
SOURCE CODE: (MDI FORM)

Private Sub BColor_Click()


CommonDialog1.ShowColor
Form1.txtcolor.BackColor = CommonDialog1.Color
End Sub

Private Sub Exit_Click()


Unload Me
End Sub

Private Sub Fonts_Click()


CommonDialog1.Flags = cdlcfbothorcdicfelects
CommonDialog1.ShowFont
Form1.txtcolor.FontName = CommonDialog1.FontName
Form1.txtcolor.FontBold = CommonDialog1.FontBold
Form1.txtcolor.FontItalic = CommonDialog1.FontItalic
Form1.txtcolor.FontUnderline = CommonDialog1.FontUnderline
Form1.txtcolor.FontSize = CommonDialog1.FontSize
End Sub
Private Sub FColor_Click()
CommonDialog1.ShowColor
Form1.txtcolor.ForeColor = CommonDialog1.Color
End Sub
OUTPUT:

RESULT:
EX NO:5 CREATE A SIMPLE CALCULATOR USING
DATE: WINDOWS COMMON CONTROLS

AIM:

PROCEDURE:
PROPERTY SETTINGS:

CONTROL NAME PROPERTY VALUE

TextBox Textbox1 Text

Textbox1 Name txtResult

Command1 caption 1

Command1 Name cmdOne

Command2 caption 2

Command2 Name cmdTwo

Command3 Caption 3
Command Button Command3 Name cmdThree

Command4 Caption 4

Command4 Name cmdFour

Command5 Caption 5

Command5 Name Cmdfive

Command6 Caption 6

Command6 Name cmdSix

Command7 Caption 7

Command7 Name cmdSeven

Command8 Caption 8

Command8 Name cmdEight

Command9 Caption 9
Command9 Name cmdNine

Command10 Caption 0

Command10 Name cmdZero

Command11 Caption C

Command11 Name cmdC

Command12 Caption MOD

Command12 Name cmdmod

Command13 Caption *
Command Button Command13 Name cmdmul

Command14 Caption /

Command14 Name cmdDiv

Command15 Caption -

Command15 Name cmdMinus

Command16 Caption +

Command16 Name cmdPlus

Command17 Caption .

Command17 Name cmdDot

Command18 Caption X^2

Command18 Name cmdSqr

Command19 Caption =

Command19 Name cmdeEq


FORM DESIGN:
SOURCE CODE:

Option Explicit

Dim operand1 As Double, operand2 As Double

Dim operator1 As String

Private Sub cmdc_Click()

txtresult.Text = ""

End Sub

Private Sub cmddiv_Click()


operand1 = Val(txtresult.Text)

operator1 = "/"

txtresult.Text = ""

End Sub

Private Sub cmddot_Click()


If InStr(txtresult.Text, ".") Then

Exit Sub

Else

txtresult.Text = txtresult.Text + "."

End If

End Sub
Private Sub cmdeight_Click()

txtresult = txtresult & 8

End Sub

Private Sub cmdeq_Click()

Dim result As Double

operand2 = Val(txtresult.Text)

If operator1 = "+" Then

result = operand1 + operand2

End If

If operator1 = "-" Then

result = operand1 - operand2

End If

If operator1 = "*" Then

result = operand1 * operand2

End If

If operator1 = "/" And operand2 <> 0 Then

result = operand1 / operand2

End If

If operator1 = "Mod" Then

result = operand1 Mod operand2

End If
txtresult.Text = result

End Sub

Private Sub cmdfive_Click()


txtresult = txtresult & 5

End Sub

Private Sub cmdfour_Click()

txtresult = txtresult & 4

End Sub

Private Sub cmdminus_Click()


operand1 = Val(txtresult.Text)

operator1 = "-"

txtresult.Text = ""

End Sub

Private Sub cmdmod_Click()

operand1 = Val(txtresult.Text)

operator1 = "Mod"

txtresult.Text = ""

End Sub
Private Sub cmdmul_Click()

operand1 = Val(txtresult.Text)

operator1 = "*"

txtresult.Text = ""

End Sub

Private Sub cmdnine_Click()

txtresult = txtresult & 9

End Sub

Private Sub cmdone_Click()

txtresult = txtresult & 1

End Sub

Private Sub cmdplus_Click()

operand1 = Val(txtresult.Text)

operator1 = "+"

txtresult.Text = ""

End Sub

Private Sub cmdseven_Click()

txtresult = txtresult & 7

End Sub
Private Sub cmdsix_Click()

txtresult = txtresult & 6

End Sub

Private Sub cmdsqr_Click()

If txtresult.Text < 0 Then

MsgBox ("Can't calculate the square root of a negative number")

Else: txtresult.Text = Sqr(Val(txtresult.Text))

End If

End Sub

Private Sub cmdthree_Click()

txtresult = txtresult & 3

End Sub

Private Sub cmdtwo_Click()


txtresult = txtresult & 2

End Sub

Private Sub cmdzero_Click()

txtresult = txtresult & 0

End Sub
OUTPUT:

24

RESULT:
EX NO:6 BLOCK FOR FACTORIAL USING FUNCTION
DATE:

AIM:

PROCEDURE:
PROPERTY SETTINGS:

CONTROL NAME PROPERTY VALUE

Factorial Of a
Label1 Caption Number

Label Label2 Caption Enter the number

Command1 Caption CALCULATE

Command1 Name cmdclc

Command2 Caption CLEAR

Command2 Name cmdclr

Command3 Caption CLOSE

Command button Command3 Name cmdcls


FORM DESIGN:
SOURCE CODE:

Private Sub cmdclc_Click()

Dim j, I As Integer

I = CInt(txtno.Text)

MsgBox "FACTORIAL OF GIVEN NUMBER IS " & FACTS(I), vbInformation,


"FACTORIAL"

End Sub

Private Function FACTS(I)

F=1

For j = 1 To I

F=F*j

FACTS = F

Next j

End Function

Private Sub cmdclr_Click()

txtno.Text = ""

txtno.SetFocus

End Sub

Private Sub cmdcls_Click()

Unload Me

End Sub
OUTPUT:

RESULT:
EX NO: 7 PAY-ROLL SYSTEM
DATE:

AIM:

PROCUDURE:
PROPERTY SETTINGS:
CONTROL NAME PROPERTY VALUE
Command1 Name Cmdclc
Command2 Name Cmdclose
Command button Command1 Caption Calculate
Command2 Caption Close
Text1 Name Txtbp
Text2 Name Txthra
Text3 Name Txtcon
Text4 Name Txtall
Text5 Name Txtgp
Text6 Name Txtpf
Text7 Name Txtlic
Text8 Name Txtemi
Text9 Name Txtdet
Text10 Name Txtnp
Text1 Text
Textbox
Text2 Text
Text3 Text
Text4 Text
Text5 Text
Text6 Text
Text7 Text
Text8 Text
Text9 Text
Text10 Text
Label1 Caption Payroll Processing
Label2 Caption Basic pay
Label3 Caption HRA(15%)
Label4 Caption DA(40%)
Label
Label5 Caption Conveyance(10%)
Label6 Caption LIC
Label7 Caption Income Tax
Label8 Caption Loans
Label9 Caption Others
Label10 Caption Gross Salary
Label11 Caption Net Salary
Frame1 Caption Allowance
Frame Frame2 Caption Deduction
FORM DESIGN:
SOURCE CODE:

Private sub cmdclc_click()


If txtbp.text=” ” then

Msgbox”you should Enter Basic Pay”

Txtbp.setfocus

End if

Txthra.text=val(txtbp.text)*10/100

Txtcon.text=val(txtbp.text)*20/100

Txtall.text=val(txthra.text)+val(txtcon.text)

Txtgp.text=val(txtbp.text)+val(txtall.text)

Txtdet.text=val(txtpf.text)+val(txtlic.text)+val(txtemi.text)

Txtnp.text=val(txtgp.text)-val(txtdet.text)

End sub

Private sub cmdclc_click()


End
End sub
OUTPUT:

RESULT:
EX NO: 8 INVENTARY PROCESSING SYSTEM
DATE:

AIM:

PROCUDURE:

You might also like