|
-
Jul 26th, 2005, 11:29 AM
#1
Thread Starter
Hyperactive Member
open file dialog help
can anyone guide me? i read up on how to open the openfile dialog box in vb6 but it said to drag the openfiledialog control onto the form but i have searched everywhere and i cant find that control
does anyone know how to get it
-
Jul 26th, 2005, 11:31 AM
#2
Re: open file dialog help
Projects/Components/Microsoft Common Dialog Control
-
Jul 26th, 2005, 11:34 AM
#3
Fanatic Member
Re: open file dialog help
You have to add the component to your project first.
Go to Project> Component
scrol down
then check Microsoft Common Dialog Control
then click ok
you should have the dialog control on your toolbox thing
then you add it like any other component (click, drag)
HTH
Using VB6 or VB.net 2008 with .net 3.5
"Life... death... either way I'll be confined to a small cubicle!" - Hermes Conrad
-
Jul 27th, 2005, 04:37 AM
#4
Thread Starter
Hyperactive Member
Re: open file dialog help
thanks for the help so far
i have read up on this but what this book told me to do didnt work so how would i get the open file dialog box to come up once it is on the form
-
Jul 27th, 2005, 07:41 AM
#5
Fanatic Member
Re: open file dialog help
Here's one that i used to open text files if you want to change that you can change the extension to whatever you want to filter for (ex: .xls, .doc ....) or you can change it to not filter.
VB Code:
Private Sub Command1_Click()
strFilter = "Text (*.txt)|*.txt|All Files (*.*)|*.*"
cdMain.Filter = strFilter
'Open the common dialog in open mode
cdMain.ShowOpen
txtOpen.Text = cdMain.FileName
End Sub
For this bit of code the common dialog control was renamed to cdMain.
HTH
Using VB6 or VB.net 2008 with .net 3.5
"Life... death... either way I'll be confined to a small cubicle!" - Hermes Conrad
-
Jul 28th, 2005, 12:29 PM
#6
Thread Starter
Hyperactive Member
Re: open file dialog help
how do select a specific folder to be the one which appears when the open file dialog is first run
-
Jul 28th, 2005, 12:44 PM
#7
Fanatic Member
Re: open file dialog help
Here you go. Just add the InitDir command and set it equal to the directory that you want.
VB Code:
Private Sub Command1_Click()
strFilter = "Text (*.txt)|*.txt|All Files (*.*)|*.*"
cdMain.Filter = strFilter
cdMain.InitDir = "C:\YourDirectory"
'Open the common dialog in open mode
cdMain.ShowOpen
txtOpen.Text = cdMain.FileName
End Sub
HTH
Using VB6 or VB.net 2008 with .net 3.5
"Life... death... either way I'll be confined to a small cubicle!" - Hermes Conrad
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|