Open box

quinty
04-03-2001, 01:34 AM
I want to insert a path to a picture but don't want to type the path. I want to to that with a pop-up screen like an open box from a program....

How do I get some box which will give back the path to a picture?

Thanx

anhmytran
04-03-2001, 08:02 AM
Create a brand new project with its defaul Form:
' Hold down Control key and press T key
Select "Microsoft Common Dialog Control 6.0"
which is from Visual Basic Service Park 3
available for download from MSDN site
within Visual Basic Service Park 4 and 5.
Click Apply and OK, then double click the control
Select it, and name it as dlgTran in the property window.
Copy and paste the following code and run:

Option Explicit

Private Sub Form_Click()
Dim strFilter As String
Dim strPicFile As String
' There is no spaces between 2 categories
strFilter = "Word and any spaces |*.doc|" & _
"Text may be spaces here, too |*.txt|Picture |*.bmp; *.jpg"
With dlgTran
.Filter = strFilter
.ShowOpen
strPicFile = .FileName
End With
' Feed back to see the file name
MsgBox strPicFile, vbOKOnly, "AnhMy Tran"
End Sub

AnhMy_Tran

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum