:confused:
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
Printable View
:confused:
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
Projects/Components/Microsoft Common Dialog Control
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
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
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
how do select a specific folder to be the one which appears when the open file dialog is first run
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