• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 421
  • Last Modified:

setting default extension on an open dialog box for Visual Basic 6.0

I've got the following working great to set the default to look up text files:

With CommonDialog1
        .Filter = "Text Files|*.txt"
        .InitDir = "G:\pj\"
        .ShowOpen
    End With

But when I change it to find AutoCAD scripting files (.scr file extension) I get nothing to show up for the open dialog box.
Please tell me why?

I've tried this and...
With CommonDialog1
        .Filter = "Script Files|*.scr"
        .InitDir = "G:\pj\"
        .ShowOpen
    End With

that...
With CommonDialog1
        .Filter = "|*.scr"
        .InitDir = "G:\pj\"
        .ShowOpen
    End With
0
stephenlecomptejr
Asked:
stephenlecomptejr
  • 7
  • 3
1 Solution
 
gecko_au2003Commented:
With CommonDialog1
        .Filter = "Script Files|*.*scr"
        .InitDir = "G:\pj\"
        .ShowOpen
    End With

What about something like that ?
0
 
stephenlecomptejrAuthor Commented:
nope didn't work.
I swear to you its there.
I'm trying to do this through a map network drive to a folder on my C:\ by the way.
0
 
gecko_au2003Commented:
I found this :

' Sets the File List box to Word documents and Excel documents
CommonDialog1.Filter = "Word Documents (*.doc)|*.doc|Excel Spreadsheets (*.xls)|*.xls"

So maybe try and alter it to :

' Sets the File List box to Word documents and Excel documents
CommonDialog1.Filter = "Script Files(*.scr)|*.scr|All Files(*.*)|*.*"

which in your code would be :

With CommonDialog1
        .Filter =  "Script Files(*.scr)|*.scr|All Files(*.*)|*.*"
        .InitDir = "G:\pj\"
        .ShowOpen
    End With
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
gecko_au2003Commented:
ok so your trying to open script files from a remote computer or the script files are actually on your computer ??
0
 
gecko_au2003Commented:
Also what about looking in to the flags property ( with regards to reading or viewing hidden files ). Look on this site :

http://www.developerfusion.com/show/11/3/
0
 
stephenlecomptejrAuthor Commented:
the script files are actually on my computer
One script file called signtag.scr is in my C:\ECdwgs\FKP\access\
I have it shared out over a network and then I mapped out to G:\.
Thus I get G:\pj\
....oh gotcha
you're right.
0
 
gecko_au2003Commented:
Take a look at this :

http://support.microsoft.com/kb/q161286/

The API to do it for you , you will obviously need to alter the coding to suit your needs for changing the filter to scr etc :)
0
 
stephenlecomptejrAuthor Commented:
yep shows up.
Thank you.
0
 
gecko_au2003Commented:
Your other alternative to getting the common dialog control to work is this :

http://www.vbaccelerator.com/codelib/cmdlgd/cmdlgd.htm
0
 
gecko_au2003Commented:
Thanks for the points and grade !! btw your welcome !
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 7
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now