Вы находитесь на странице: 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:

Вам также может понравиться