0% found this document useful (0 votes)
339 views3 pages

VB Programs For MCA-2

This program allows the user to open different file types by using a combo box to select the file extension, directory controls to navigate folders, and a file control to select and display the file. It uses dynamic link libraries to open files by extension. The user can select the file type in the combo box, which updates the file control pattern to filter by that extension. When a file is selected, the name is displayed. Directory and drive controls change the active folder.

Uploaded by

Gaurav Saxena
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
339 views3 pages

VB Programs For MCA-2

This program allows the user to open different file types by using a combo box to select the file extension, directory controls to navigate folders, and a file control to select and display the file. It uses dynamic link libraries to open files by extension. The user can select the file type in the combo box, which updates the file control pattern to filter by that extension. When a file is selected, the name is displayed. Directory and drive controls change the active folder.

Uploaded by

Gaurav Saxena
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 3

Program No.

: - 14
Name: - Gaurav Saxena Roll No. : - 1308727
rd
Class: - MCA (3 Sem.) Page No. :-_______
Statement: - Write a program to open any type of file (like .doc, .txt, .pdf, .bmp etc ) by using
drive, dir and file controls and using dynamic link libraries(DLL) concepts..

Private Sub Combo1_Change()


Select Case Combo1.ListIndex
Case 0
File1.Pattern = "*.*"
Case 1
File1.Pattern = "*.doc"
Case 2
File1.Pattern = "*.txt"
Case 3
File1.Pattern = "*.pdf"
Case 4
File1.Pattern = "*.bmp"
End Select
End Sub

Private Sub Command1_Click()


If Text1.Text = "" Then
MsgBox "no file was selected"
Else
MsgBox "selected file is" + Text1.Text
End If
End Sub

Private Sub Command2_Click()


End
End Sub

Private Sub Dir1_Change()


File1.Path = Dir1.Path
Label4.Caption = Dir1.Path
End Sub

Private Sub Drive1_Change()


On Error GoTo errortrap
Dir1.Path = Drive1.Drive
Exit Sub
errortrap:
MsgBox "drive error!", vbExclamation, "error"
Drive1.Drive = Dir1.Path
Exit Sub
End Sub

Private Sub File1_Click()


Text1.Text = File1.FileName
End Sub

Private Sub Form_Load()


Combo1.AddItem "all files(*.*)"
Combo1.AddItem "all files(*.doc)"
Combo1.AddItem "all files(*.txt)"
Combo1.AddItem "all files(*.pdf)"
Combo1.AddItem "all files(*.bmp)"
Combo1.ListIndex = 0
Label4.Caption = Dir1.Path
End Sub

OUTPUT:
Program No. : - 13
Name: - Gaurav Saxena Roll No. : - 1308727
rd
Class: - MCA (3 Sem.) Page No. :-_______
Statement: - : Create an Active x control for calendar control to display the age of candidate
according to date of birth entered by candidate.

Private Sub Calendar1_Click()


Text1 = Calendar1.Value
Calendar1.Visible = False
End Sub

Private Sub Command1_Click()


Calendar1.Visible = True
End Sub

Private Sub Command2_Click()


MsgBox DTPicker1.Value
End Sub

Private Sub Form_Load()


Text2 = Date
Calendar1.Visible = False
End Sub

OUTPUT:

You might also like