Bca3rd Year
Bca3rd Year
OF
VISUAL BASIC
Output:-
2.Program for cut, copy, paste, seltext, sellen, selstart.
Coding:-
Dim data As String
Private Sub clear_Click()
Text2.Text = " "
End Sub
Output:-
Output:-
4. Program for total average.
Coding:-
Private Sub exit_Click()
End
End Sub
Output:-
sum = 0
For i = 1 To n
num(i) = Val(InputBox("ENTER NUMBER" & i))
sum = sum + num(i)
Print "NUMBER" & i & "IS" & num(i)
Next
mean = sum / n
Print
Print "AVERAGE IS" & mean
End Sub
Output:-
7.program for picturebox.
Coding:-
Private Sub animal_Click()
End Sub
End Sub
End
End Sub
End Sub
End
End Sub
Output:-
8. Program for find sum of two numbers using input box method.
Coding:-
Private Sub close_Click()
End
End Sub
Output:-
9. Program for list box.
Coding:-
Private Sub Command1_Click()
List1.AddItem Text1.Text
End Sub
Output:-
Line1.Visible = False
Shape1.Visible = True
Shape1.shape = 3
End Sub
Output:-
12. Program for scroll bar.
Coding:-
Private Sub exit_Click()
End
End Sub
Coding:-
Private Sub Dir1_Change()
File1.Path = Dir1.Path
End Sub
Coding:-
Private Sub exit_Click(Index As Integer)
End
End Sub
Coding:-
Private Sub Command1_Click()
Dim number As Double
number = InputBox("enetr any number that you want to check either even or odd")
evenodd (number)
End Sub
Coding:-
Dim x As Integer
Dim sum As Integer
Private Sub Command1_Click()
x=0
sum = 0
Do While x < 10
x=x+1
sum = sum + x
Loop
Print "SUM OF TEN NUMBERS USING DO WHILE LOOP" & sum
End Sub
OUTPUT:-
17. Program for call by value and call by reference.
Coding:-
Private Sub Command1_Click()
Dim var As Integer
var = InputBox("enter value")
Print "AFTER APPLYING CALL BY VALUE FUNCTION:-"
Print
Print var
twice (var)
Print var
End Sub
Function twice(ByVal num As Integer)
num = 2 * num
Print num
End Function
Output:-
18. Program for Fibonacci series.
Coding:-
Private Sub Command1_Click()
Dim first As Integer, second As Integer, number As Integer
If Text1.Text = "" Then
MsgBox ("enetr number")
Else
first = 0
second = 1
Print second
For i = 0 To (Val(Text1.Text) - 2)
number = first + second
Print number
first = second
second = number
Next i
End If
End Sub
Private Sub exit_Click()
End
End Sub
Output:-
19. Program for find sum of matrices.
Coding:-
Private Sub exit_Click()
End
End Sub
For i = 1 To m
For j = 1 To n
sum(i, j) = a(i, j) + b(i, j)
Next
Next
Print
Print "sum of matrices is:"
For i = 1 To m
For j = 1 To n
Print sum(i, j)
Next
Print
Next
End Sub
Output:-
20. Program for menu editor.
Coding:-
Private Sub exit_Click()
End
End Sub
Coding:-
Private Sub exit_Click()
End
End Sub
Coding:-
Dim a, b, c, d As Double
Private Sub back_Click()
restaurant.Show
End Sub
OUTPUT:-
22. program for built in function.
Coding:-
Private Sub Command1_Click()
Dim x, a As Integer
a = InputBox("enter number")
Print "the value of a is:"; a
Print
Print
Print "square root of a is:" & Sqr(a)
Print
Print
Print "absolute value of a is:" & Abs(-20)
Print
Print
End Sub
Output:-
23.program for passing an array to procedure.
Coding:-
Private Sub exit_Click()
End
End Sub
Coding:-
Public Function RArray() As Variant
Dim a(2) As Integer
a(0) = 1
a(1) = 2
a(2) = 3
RArray = a
End Function
Output:-
25. Program for Pop Up Menu.
Coding:-
Private Sub Form_mousedown(button As Integer, shift As Integer, x As Single, y As
Single)
If button = vbRightButton Then
popupmenu mnuformatpopup
End If
End Sub
Output:-