Program 1:
Private Sub mnuLoad_Click()
[Link] = "Image Files|.bmp;.jpg;.jpeg;.gif"
[Link]
If [Link] <> "" Then
[Link] = LoadPicture([Link])
[Link] = True
End If
End Sub
Exit Menu
Private Sub mnuExit_Click()
Unload Me
End Sub
***Increase Image
Private Sub optInc_Click()
If [Link] = 1 Then
[Link] = [Link] + 300
End If
If [Link] = 1 Then
[Link] = [Link] + 300
End If
End Sub
**Decrease Image
Private Sub optDec_Click()
If [Link] = 1 Then
[Link] = [Link] - 300
End If
If [Link] = 1 Then
[Link] = [Link] - 300
End If
End Sub
Program 2:
Private Sub cmdCalculate_Click()
Dim Basic As Double
Dim HRA As Double
Dim DA As Double
Dim PF As Double
Dim Gross As Double
Dim Net As Double
Basic = Val([Link])
HRA = Basic * 0.2
DA = Basic * 0.15
PF = Basic * 0.12
Gross = Basic + HRA + DA
Net = Gross - PF
[Link] = Format(HRA, "0.00")
[Link] = Format(DA, "0.00")
[Link] = Format(PF, "0.00")
[Link] = Format(Gross, "0.00")
[Link] = Format(Net, "0.00")
End Sub
Private Sub cmdClear_Click()
[Link] = ""
[Link] = ""
[Link] = ""
[Link] = ""
[Link] = ""
[Link] = ""
[Link] = ""
[Link] = ""
[Link]
End Sub
Private Sub cmdExit_Click()
Unload Me
End Sub
Program 3:
Labels -4 ,Text Box-4, Command Button-2
Coding:
Private Sub Command1_Click()
Dim Cost As Double
Dim Salvage As Double
Dim Life As Double
Dim Dep As Double
Cost = Val([Link])
Salvage = Val([Link])
Life = Val([Link])
If Life <= 0 Then
MsgBox "Useful Life must be greater than zero.", vbExclamation
Exit Sub
End If
Dep = (Cost - Salvage) / Life
[Link] = Format(Dep, "0.00")
End Sub
Private Sub Command2_Click()
[Link] = ""
[Link] = ""
[Link] = ""
[Link] = ""
[Link]
End Sub
Program 4:
Label Box – 4 and Command Button -2 and Text Box – 4.
Private Sub Command1_Click()
Dim Sales As Double
Dim VariableCost As Double
Dim FixedCost As Double
Dim Interest As Double
Dim Contribution As Double
Dim EBIT As Double
Dim EBT As Double
'Input values
Sales = Val([Link])
VariableCost = Val([Link])
FixedCost = Val([Link])
Interest = Val([Link])
'Calculations
Contribution = Sales - VariableCost
EBIT = Contribution - FixedCost
EBT = EBIT - Interest
'Display Results
[Link] = Format(Contribution, "0.00")
[Link] = Format(EBIT, "0.00")
[Link] = Format(EBT, "0.00")
If EBIT <> 0 Then
[Link] = Format(Contribution / EBIT, "0.00")
Else
[Link] = "Undefined"
End If
If EBT <> 0 Then
[Link] = Format(EBIT / EBT, "0.00")
[Link] = Format(Contribution / EBT, "0.00")
Else
[Link] = "Undefined"
[Link] = "Undefined"
End If
End Sub
Program 5 :
Text Box-3 and Label Box-2 and Command Button -1
Private Sub Command1_Click()
Dim Rate As Double
Dim Nper As Integer
Dim Pmt As Double
Dim PV As Double
Dim FV As Double
'Input values
Rate = Val([Link]) / 100
Nper = Val([Link])
Pmt = Val([Link])
'Calculate Present Value
PV = -Pmt * ((1 - (1 + Rate) ^ (-Nper)) / Rate)
'Calculate Future Value
FV = Pmt * (((1 + Rate) ^ Nper - 1) / Rate)
'Display results
[Link] = Format(PV, "0.00")
[Link] = Format(FV, "0.00")
End Sub
Program 6 :
Private Sub MDIForm_Load()
[Link](1).Key = "new"
[Link](2).Key = "open"
[Link](3).Key = "save"
End Sub
Private Sub mnuNew_Click()
Dim frm As New Form1
[Link] = "Child " & ([Link] Is Nothing)
[Link]
End Sub
Private Sub mnuOpen_Click()
[Link]
MsgBox "Opening: " & [Link]
End Sub
Private Sub mnuExit_Click()
End
End Sub
Private Sub mnuCascade_Click()
[Link] vbCascade
End Sub
Private Sub mnuTileHorizontal_Click()
[Link] vbTileHorizontal
End Sub
Private Sub mnuTileVertical_Click()
[Link] vbTileVertical
End Sub
Private Sub mnuArrangeIcons_Click()
[Link] vbArrangeIcons
End Sub
Private Sub Toolbar1_ButtonClick(ByVal Button As [Link])
Select Case [Link]
Case "new"
Call mnuNew_Click
Case "open"
Call mnuOpen_Click
Case "save"
MsgBox "Save clicked"
End Select
End Sub
Private Sub Form_Load()
[Link] = "New Document"
[Link] = vbWhite
End Sub
Program 7:
Text Box -2 and Command Button -1 and Label -1
Private Sub Command1_Click()
Dim Amount As Double
Dim Rate As Double
Dim Result As Double
'Input values
Amount = Val([Link])
Rate = Val([Link])
'Currency Conversion
Result = Amount * Rate
'Display Result
[Link] = Format(Result, "0.00")
End Sub
Program 8:
Text Box-4 and Label -1 and Command button -1
Private Sub Command1_Click()
Dim NPer As Integer
Dim Pmt As Double
Dim PV As Double
Dim FV As Double
Dim CostOfCapital As Double
'Input values
NPer = Val([Link])
Pmt = Val([Link])
PV = Val([Link])
FV = Val([Link])
'Calculate Cost of Capital (Interest Rate)
CostOfCapital = Rate(NPer, Pmt, PV, FV) * 100
'Display Result
[Link] = Format(CostOfCapital, "0.00") & "%"
End Sub
Program 9:
Private Sub Drive1_Change()
On Error Resume Next
[Link] = [Link]
End Sub
Private Sub Dir1_Change()
[Link] = [Link]
End Sub
Private Sub File1_Click()
Dim FullPath As String
If Right([Link], 1) <> "\" Then
FullPath = [Link] & "\" & [Link]
Else
FullPath = [Link] & [Link]
End If
On Error GoTo ErrHandler
[Link] = LoadPicture(FullPath)
[Link] = "Advertisement: " & [Link]
Exit Sub
ErrHandler:
MsgBox "Cannot load this file as picture",
vbExclamation
End Sub
Program 10:
Text Box-1 and Command button-1 and Label -1 and Option button-2 and Check Box-3.
Private Sub Command1_Click()
Dim Investment As Double
Dim TotalBudget As Double
Investment = Val([Link])
TotalBudget = Investment
'Option Button - Select Project
If [Link] = True Then
TotalBudget = TotalBudget + 50000
ElseIf [Link] = True Then
TotalBudget = TotalBudget + 100000
End If
'Check Box - Additional Expenses
If [Link] = 1 Then
TotalBudget = TotalBudget + 10000
End If
If [Link] = 1 Then
TotalBudget = TotalBudget + 5000
End If
If [Link] = 1 Then
TotalBudget = TotalBudget + 3000
End If
[Link] = "Capital Budget = Rs. " & Format(TotalBudget, "0.00")
End Sub
Program 11:
Private Sub cmdAdd_Click()
[Link]
MsgBox "Enter new record and click Update", vbInformation
End Sub
Private Sub cmdUpdate_Click()
[Link]("ItemCode") = [Link]
[Link]("ItemName") = [Link]
[Link]("Quantity") = Val([Link])
[Link]("Rate") = Val([Link])
[Link]("Value") = Val([Link]) * Val([Link])
[Link]
MsgBox "Record Saved", vbInformation
End Sub
Private Sub cmdDelete_Click()
[Link]
[Link]
If [Link] Then [Link]
End Sub
Private Sub cmdNext_Click()
[Link]
If [Link] Then [Link]
End Sub
Private Sub cmdPrevious_Click()
[Link]
If [Link] Then [Link]
End Sub
Program 12:
Option Button-2 and Command Button-2 and Textbox-1 and Listbox-1 and Combo box-
1,Label box-1.
Private Sub Command1_Click()
Dim Item As String
Dim Qty As Integer
Dim Rate As Double
Dim Amount As
Double
Item = [Link]
Qty = Val([Link])
'Option Button for Item Rate
If [Link] = True Then
Rate = 50
ElseIf [Link] = True Then
Rate = 30
End If
Amount = Qty * Rate
'Add item to ListBox
[Link] Item & vbTab & Qty & vbTab & Rate & vbTab & Amount
[Link] = Val([Link]) + Amount
End Sub
Private Sub Command2_Click()
[Link]
[Link] = "0"
End Sub
Program 13:
Text Box -4 and Command Button -3 and Common Controls -1 and MSFlex Grid Control-1
Private Sub Command1_Load()
'Initialize MSFlexGrid
[Link] = 2
[Link] = 4
[Link](0, 0) = "Customer ID"
[Link](0, 1) = "Customer Name"
[Link](0, 2) = "City"
[Link](0, 3) = "Balance"
End Sub
Private Sub Command2_Click()
Dim r As Integer
r = [Link] - 1
[Link](r, 0) =
[Link] [Link](r, 1)
= [Link] [Link](r,
2) = [Link]
[Link](r, 3) = [Link]
[Link] = [Link] + 1
[Link] = [Link] + 10
End Sub
Private Sub Command3_Click()
MsgBox "Customer Report Prepared Successfully!", vbInformation
End Sub
Program 14:
ADO Control-1 and Text Box-4 and Command Button-2 and Common Control-1.
Private Sub Command1_Load()
'Connect to Student Database
[Link] = _
"Provider=[Link].4.0;Data Source=C:\[Link];"
[Link] = "SELECT * FROM Student"
[Link]
'Bind TextBoxes with ADO Control
Set [Link] = Adodc1
[Link] = "RollNo"
Set [Link] = Adodc1
[Link] = "Name"
Set [Link] = Adodc1
[Link] = "Course"
Set [Link] = Adodc1
[Link] = "Marks"
End Sub
Private Sub Command2_Click()
[Link] = 100
MsgBox "Student Report Prepared Successfully!", vbInformation
End Sub