1) Wap to show arithmetic operator
Design-
Coding-
Private Sub CommandI_Click()
Dim a As
Integer Dim b
As Integer a =
Textl.Text b =
Text2.Text
Text3.Text = a - b
End Sub
Private Sub Command2_
Dim a As
Integer Dim b
As Integer a =
Textl.Text
b • Text2.Text
Text3.Text a + b End
Sub
Private Sub
Dim a As
Integer Dim b
As Integer a
Textl.Text b
Text2.Text
Text3.Text= a • b
End Sub
Private Sub
Dim a As Integer
Dim b As Integer
a = Textl.Text b =
Text2.Text
Text3.Text = b
End Sub
Output-
2) Wap to calculate biggest number from array
Design-
Coding-
Private Sub Command1_Click()
Dim s(l To 10) As Integer
Dim i As Integer Dim
greater As Integer Dim a
As Integer a =
InputBox("enter array")
For i = 1 Toa s(i) =
InputBox("array are")
Print s(i)
Next i
greater = s(l)
For i = 1 Toa
If greater s(i) Then
greater • s(i) End If
Next i Print
greater
End Sub
Output-
Output-
3) Wap to show check box
Designs-
Coding-
Private Sub Checkl_Click()
If Checkl.Value = 1 Then
Textl.Font.Bold = True
Else
Textl.Font.Bold
End If
End Sub
Private
Sub Check2_Click()
If Check2.Value = i Then
Textl.Font.ltalic = True
Else
Textl.Font.ItaIic = False
End If
End Sub
Private Sub Check3_Click()
If Check3.Value = I Then
Textl.Text = UCase(TextI.Text)
End If
End Sub
Private Sub Check4_CIick()
If Check4.Value = 1 Then
Textl.Font.UnderIine = True
Else
Textl.Font.Underline = False
End If
End Sub
Private Sub Check5_Click()
If Check5.Value = 1 Then
Textl.Font.Strikethrough =
True
Else
Textl.Font.Strikethrough =
False
End If
End Sub
Private Sub Check6_Click()
If Check6.Value = 1
Then
Textl.Text = LCase(Text1.Text)
End If
End Sub
Output-
Wap to
Design:
4) WAP To calculate area of circle
Design-
Coding-
Private Sub Command1_Click()
Dim area As Integer
Const pi 3.14 area = pi *
Textl.Text * Textl.Text
MsgBox (area)
End Sub
5) Calculate factorial of number
Design-
Coding-
Private Sub CommandI_CIick()
Dim n As Integer
Dim i As Integer Dim fct As
Integer fct=l n =
InputBox("enter a number")
Fori 1 To n
fct i Next i
Print fct
End Sub
Output-
6) Convert Fahrenheit to Celsius
Design-
Coding-
Private Sub VScr0111_Change()
Dim f As Integer
Dim c As Integer
f =
VScr0111.Value
Textl.Text = f
Text2.Text = c
End Sub
Output-、
series
Coding-
Private Sub CommandI_Click()
Dim s As Integer
Dim sl As Integer
Dim nxt As Integer
Dim n As Integer
Dim i As Integer
n = InputBox("enter a number")
For i = ITO n
If i 1 Then
nxt = i
Else
nxt S + SI
Sl nxt End
If
Print nxt
Next i
End Sub
Output-
8) WAP To show imagelist and viewlist
Design-
Coding-
Private Sub Form_Load()
Dim iteml As Listltem
Dim item2 As Listltem
Set item2 =
ListView1.Listltems.Add
item2.Text = "Tree" item2.lcon =
2
Dim item3 As Listltem Set item3 =
ListView1.Listltems.Add
item3.Text "Waterfall" em3.lcon =
3
Set iteml = ListView1.Listltems.Add item1.Text =
"Forest" iteml.lcon =
End sub
Output-
9) WAP To Show Linear Search
Design-
Coding-
Private Sub Command1_ClickO
Dim 10) As Integer
Dim i As Integer
Dim s As Integer
For i = O To 4 a(i)
numbers")
Print a(i)
Next i
Fori=OT04
If a(i) = Textl.Text Then
MsgBox (enumbr is found")
End tf
ext i s = 0 Then sgBox
("number is not found") nd If
End Sub
Output-
10) Wap to show option box
Design-
Coding-
Private Sub Option1_Click()
Checkl.Value = 1
Check2.Value = O
Check3.Value = 1
Check4.Value = 1
End Sub
Private Sub Option2_Click()
Checkl.Value = O
Check2.Value = O
Check3.Value = I
Check2,VaIuo
Check3 Value
Check4 Value
End Sub
Private Sub
Checkl,Value O
Check1,Value2
Check3.Value O Check4,Value1
End Sub
Output-
11) WAP To Show Palindrome of a Number
Design-
Coding-
Private Sub Command1_Click()
Dim digit As
Long Dim mum
As Long mum =
O Do
digit = Textl.Text Mod 10
Textl.Text = Textl.Text \
10
mum = mum * 10 + digit
Loop While (Textl.Text > O)
If mum = Textl.Text Then
MsgBox ("the number is a palindrome")
Else
MsgBox ("the number is not a palindrome")
End Sub
Output-
12) WAP To Show is Prime Number
Design-
Coding-
Private Sub CommandI_CIick()
Dim n As Integer
Dim i As Integer
Dim p As Integer
n InputBox("enter a no.")
Fori=2 Ton-I
If (n Mod i = O) Then
End If
Next i
If p = 1 Then
sgBox ("not a prime no.")
Ise sgBox ("prime
no.")
End If
End Sub
Output-
13) WAP To Write an Application Using
Progress Bar
Design –
Coding-
privateSubTimer1_Timer()
progressBar1.Value = ProgressBar1.Value +
1
Labell.Caption=ProgressBar1.Value&
"'completed"
If ProgressBar1,Value 100 Then
End
End If
End Sub
Output-
14) Wap to show reverse of a number
Design-
Coding-
Private Sub CommandI_Click()
Dim i As Integer
Dim s As Integer Dim rvrs As Integer
rvrs = O
i = Val(Text1.Text) While (i o O)
Mod 10
rvrs = rvrs * 10 + s
Wend
Text2.Text rvrs
Print rvrs
End Sub
Output -
15) WAP To Show Rich Textuboxes
Design-
Desig
Coding-
Private Sub cmdcolor_Click()
CommonDialog1.showcolor
RichTextBox1.SelColor = CommonDialog1.Color End Sub
Private Sub cmdfont_Click()
CommonDialog1.showfont
RichTextBox1.SelFontName = Common Dialog1.FontName
End Sub
Output-
16) WAP To write an application using slider
control
Design-
Coding-
Private Sub Slider1_Click()
Labell.Caption = Slider1.Value
End Sub
Output-
17) WAP TO Write Application Using Status Bar
Design-
Coding-
Private Sub StatusBar1_PanelClick(ByVal Panel As
MSComctlLib.Panel)
MsgBox ("This is a status bar")
End Sub
Output-