Problem in CommonDialog 
Author Message
 Problem in CommonDialog

Dear all,
I have a problem in CommonDialog box in eVB. My code is follows:
Public Function GetFileToOpen()
 Dim fileflags As FileOpenConstants
 Dim filefilter As String
 'Set the text in the dialog title bar
 CommonDialog1.DialogTitle = "Open"
 'Set the default file name and filter
 CommonDialog1.InitDir = App.Path & "\" 'dataPath
 CommonDialog1.filename = ""
 CommonDialog1.Filter = "Text files|*.txt"
 CommonDialog1.FilterIndex = 0
 'Verify that the file exists
 fileflags = cdlOFNFileMustExist
 CommonDialog1.Flags = fileflags
 'Show the Open common dialog box
 CommonDialog1.ShowOpen
 'Return the path and file name selected or
 'Return an empty string if the user cancels the dialog
 GetFileToOpen = CommonDialog1.filename
End Function

However, I can't change the initial directory to application path. It also
start at "My Document" in PC2002.

Please help



Mon, 18 Apr 2005 11:22:09 GMT  
 Problem in CommonDialog
BUG: CE CommonDialog: ShowOpen Displays Only My Document Files
http://support.microsoft.com/default.aspx?scid=kb;[LN];Q253335


Quote:
> Dear all,
> I have a problem in CommonDialog box in eVB. My code is follows:
> Public Function GetFileToOpen()
>  Dim fileflags As FileOpenConstants
>  Dim filefilter As String
>  'Set the text in the dialog title bar
>  CommonDialog1.DialogTitle = "Open"
>  'Set the default file name and filter
>  CommonDialog1.InitDir = App.Path & "\" 'dataPath
>  CommonDialog1.filename = ""
>  CommonDialog1.Filter = "Text files|*.txt"
>  CommonDialog1.FilterIndex = 0
>  'Verify that the file exists
>  fileflags = cdlOFNFileMustExist
>  CommonDialog1.Flags = fileflags
>  'Show the Open common dialog box
>  CommonDialog1.ShowOpen
>  'Return the path and file name selected or
>  'Return an empty string if the user cancels the dialog
>  GetFileToOpen = CommonDialog1.filename
> End Function

> However, I can't change the initial directory to application path. It also
> start at "My Document" in PC2002.

> Please help



Mon, 18 Apr 2005 13:37:01 GMT  
 Problem in CommonDialog
Thank you for your help
But I ready want to select and open any text file in application directory.
The report talk us to use the FileSystem function. But it can't browse and
select a file. Could eVB can do this function using other method.
Please advice


Quote:
> BUG: CE CommonDialog: ShowOpen Displays Only My Document Files
> http://support.microsoft.com/default.aspx?scid=kb;[LN];Q253335



> > Dear all,
> > I have a problem in CommonDialog box in eVB. My code is follows:
> > Public Function GetFileToOpen()
> >  Dim fileflags As FileOpenConstants
> >  Dim filefilter As String
> >  'Set the text in the dialog title bar
> >  CommonDialog1.DialogTitle = "Open"
> >  'Set the default file name and filter
> >  CommonDialog1.InitDir = App.Path & "\" 'dataPath
> >  CommonDialog1.filename = ""
> >  CommonDialog1.Filter = "Text files|*.txt"
> >  CommonDialog1.FilterIndex = 0
> >  'Verify that the file exists
> >  fileflags = cdlOFNFileMustExist
> >  CommonDialog1.Flags = fileflags
> >  'Show the Open common dialog box
> >  CommonDialog1.ShowOpen
> >  'Return the path and file name selected or
> >  'Return an empty string if the user cancels the dialog
> >  GetFileToOpen = CommonDialog1.filename
> > End Function

> > However, I can't change the initial directory to application path. It
also
> > start at "My Document" in PC2002.

> > Please help



Mon, 18 Apr 2005 15:08:38 GMT  
 Problem in CommonDialog

Quote:
> Thank you for your help
> But I ready want to select and open any text file in application
directory.
> The report talk us to use the FileSystem function. But it can't browse and
> select a file. Could eVB can do this function using other method.
> Please advice

My bet is that they want you to roll your dialog using a form and the
FileSystem function.

It is somewhat funny phrasing they use in that bug report. If anything works
as designed, then it isn't a bug, but a design flaw.
Otherwise we would have to believe that MS design bugs directly into the
software on purpose, and that can't be right, now can it?
:-)

Keld Laursen



Mon, 18 Apr 2005 15:41:00 GMT  
 Problem in CommonDialog
If you look up examples from early versions of VB you will see how to
construct your own file access dialogue. You use the eVB file system object
to get access to equivalent functions for VB's CHDir and DIR(). You can get
away with two simple lists - one for folders in the current folder and one
for files in the current folder - provided that you supply a method for
going backwards.  In my standard version I use two lists and insert a 'My
Device' item at the top of the folders list, for returning direct to the top
level, like File Explorer.


Quote:
> Thank you for your help
> But I ready want to select and open any text file in application
directory.
> The report talk us to use the FileSystem function. But it can't browse and
> select a file. Could eVB can do this function using other method.
> Please advice



Tue, 19 Apr 2005 06:06:23 GMT  
 Problem in CommonDialog
Thank you for your help.
Can you share your code or send it to me?
Quote:

> If you look up examples from early versions of VB you will see how to
> construct your own file access dialogue. You use the eVB file system object
> to get access to equivalent functions for VB's CHDir and DIR(). You can get
> away with two simple lists - one for folders in the current folder and one
> for files in the current folder - provided that you supply a method for
> going backwards.  In my standard version I use two lists and insert a 'My
> Device' item at the top of the folders list, for returning direct to the top
> level, like File Explorer.



> > Thank you for your help
> > But I ready want to select and open any text file in application
> directory.
> > The report talk us to use the FileSystem function. But it can't browse and
> > select a file. Could eVB can do this function using other method.
> > Please advice



Tue, 19 Apr 2005 08:15:45 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Problem with CommonDialog

2. problems with commondialog box

3. Problem creating CommonDialog from Menu

4. Problem with commondialog and multiselect, help requested

5. Problem with commondialog !

6. Problems using CommonDialog Control with new HTML help files

7. Problems with CommonDialog Printing Options in Win2K

8. Problem with CommonDialog

9. problem with commondialog

10. problem with commondialog

11. Serious Problem with CommonDialog!?!

12. problem with commondialog

 

 
Powered by phpBB® Forum Software