.showopen will show the open dialog.
VB Code:
Private Sub txtBackUp_Click() Dim oCDBForm As New frmCommonDialog x = lblSetup(1).Left + lblSetup(1).Width y = lblSetup(1).Top oCDBForm.Move x, y With oCDBForm.CommonDialog1 .DialogTitle = "Select BackUp File to use" .InitDir = RealPath .Filter = "BackUp Files (*.old)|*.old|All " & _ "Files (*.*)|*.*" .Flags = _ cdlOFNFileMustExist + _ cdlOFNHideReadOnly + _ cdlOFNLongNames + _ cdlOFNExplorer .CancelError = False ' Change to trap cancel True .ShowOpen txtBackUp.Text = .FileName End With Unload oCDBForm Set oCDBForm = Nothing End Sub
This is what I use. I have a Common Dialog Control by itself on a form that is small. I use it for all the dialogs in my app. I subclass it like shown. This is when clicking on a textbox, it puts the selected filename in the textbox.
The same dialog works for printing, saving, and everything else.




Reply With Quote