For Programmers: Free Programming Magazines  


Home > Archive > Visual Basic Enterprise > January 2006 > VB6, XP and Common dialog









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author VB6, XP and Common dialog
Alan Gillott

2006-01-19, 8:04 am

I have gone to a lot of time and trouble to persuade the Common file open
and file save dialogs to open a specific path under win 95,98,NT,2000 BUT
under Win XP the Open dialog insists on doing its own thing and displaying
My documents. How do you persuade the Common dialog to work the same under
XP as it did under win 2000 etc.

DoLibPath 'Set the correct path
cdlgEdit.FileName = ""
cdlgEdit.DialogTitle = "File Open"
cdlgEdit.Flags = cdlOFNPathMustExist
cdlgEdit.CancelError = False
cdlgEdit.action = 1
FileName = cdlgEdit.FileName


Jay Taplin

2006-01-19, 7:10 pm

Change your ".FileName =" line to the path and desired extension.

cdlgEdit.FileName = "C:\*.*"

Ken Halter

2006-01-19, 7:10 pm

"Alan Gillott" <agillott@sunglobal.com> wrote in message
news:%23WeYFDOHGHA.1728@TK2MSFTNGP09.phx.gbl...
>I have gone to a lot of time and trouble to persuade the Common file open
>and file save dialogs to open a specific path under win 95,98,NT,2000 BUT
>under Win XP the Open dialog insists on doing its own thing and displaying
>My documents. How do you persuade the Common dialog to work the same under
>XP as it did under win 2000 etc.
>
> DoLibPath 'Set the correct path
> cdlgEdit.FileName = ""
> cdlgEdit.DialogTitle = "File Open"
> cdlgEdit.Flags = cdlOFNPathMustExist
> cdlgEdit.CancelError = False
> cdlgEdit.action = 1
> FileName = cdlgEdit.FileName


The commondialog's path has little to do with any 'current path' settings
for your app. Jay mentioned one way... here's another. I added a "File must
exist" flag since you're attempting to locate a file.

Private Sub Command1_Click()
cdlgEdit.InitDir = "C:\Temp"
cdlgEdit.DialogTitle = "File Open"
cdlgEdit.Flags = cdlOFNPathMustExist Or cdlOFNFileMustExist
cdlgEdit.CancelError = False
cdlgEdit.ShowOpen
Debug.Print cdlgEdit.FileName
End Sub

--
Ken Halter - MS-MVP-VB - Please keep all discussions in the groups..
DLL Hell problems? Try ComGuard - http://www.vbsight.com/ComGuard.htm
Freeware 4 color Gradient Frame? http://www.vbsight.com/GradFrameCTL.htm


Alan Gillott

2006-01-19, 7:10 pm

thank you, there's nothing like having it under ones nose while you stare at
it and miss the obvious. Duh! sound of slap of back of hand.

"Ken Halter" <Ken_Halter@Use_Sparingly_Hotmail.com> wrote in message
news:%23FjR2ERHGHA.3176@TK2MSFTNGP12.phx.gbl...
> "Alan Gillott" <agillott@sunglobal.com> wrote in message
> news:%23WeYFDOHGHA.1728@TK2MSFTNGP09.phx.gbl...
>
> The commondialog's path has little to do with any 'current path' settings
> for your app. Jay mentioned one way... here's another. I added a "File
> must exist" flag since you're attempting to locate a file.
>
> Private Sub Command1_Click()
> cdlgEdit.InitDir = "C:\Temp"
> cdlgEdit.DialogTitle = "File Open"
> cdlgEdit.Flags = cdlOFNPathMustExist Or cdlOFNFileMustExist
> cdlgEdit.CancelError = False
> cdlgEdit.ShowOpen
> Debug.Print cdlgEdit.FileName
> End Sub
>
> --
> Ken Halter - MS-MVP-VB - Please keep all discussions in the groups..
> DLL Hell problems? Try ComGuard - http://www.vbsight.com/ComGuard.htm
> Freeware 4 color Gradient Frame? http://www.vbsight.com/GradFrameCTL.htm
>



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com