Visual Basic 6.0

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]


Solution

Private Sub Command1_Click()
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

Private Sub Dir1_Change()
File1.Path = Dir1
End Sub

Private Sub Drive1_Change()
Dir1.Path = Drive1

End Sub

Output





BCA Pratical Solution

My name is Vivek And I from Mumbai and Complete my Graduation Bca.my Age is 23 Years.

Post a Comment

Previous Post Next Post