Visual Basic 6.0
Slip 4
Q.1) Write a VB Program to display the reverse of a given number using function.
(Accept number through textbox and display result using message box) [Marks 15]
(Accept number through textbox and display result using message box) [Marks 15]
Solution
Dim n As Integer
n = Val(Text1.Text)
Dim a As Integer
Dim r As Integer
While n <> 0
a = n Mod 10
r = r * 10 + a
n = n \ 10
Wend
MsgBox ("revers is" & r)
End Sub
Output
![]() |
Reverse No. |
Q.2) Design an application in VB which has a Drivelistbox, Dirlistbox, Filelistbox control.
The form contains the following command buttons:
All drives: Display all drives in computer (including network drives)
All subdirectories: Display all subfolders of the currently selected directory.
All files : Display a popup menu which contains the following options:
a. All document files
b All bitmaps
c All files
On selection of option, display the specified type. [25 Marks]
Solution
File1.Path = Dir1
End Sub
Private Sub Drive1_Change()
Dir1.Path = Drive1
End Sub
Tags:
VB 6.0