Send a suggestion!

We're building a brand new version of the site, and we'd love to hear your ideas

Members

Technology Zones

IBM Learning Center

Articles

Hosted By

MaximumASP

Info

[11] Common Dialog Control

Last post 02-20-2007 8:28 PM by ffrreeaakk. 8 replies.
Page 1 of 1 (9 items)
Sort Posts: Previous Next
  • 01-01-1999 12:00 AM

    [11] Common Dialog Control

    This thread is for discussions of Common Dialog Control.

    • Post Points: 30
  • Advertisement

    • Red Gate Software

    Advertisement

    Want to boost your .NET application performance?

    Some developers always seem to write efficient and lightening-fast code. What is their secret? It’s ANTS Profiler. “We improved the performance of the application up to 10 times” Dan Ports, Intrigma.

    Try it for yourself now.

  • 09-23-2002 6:28 PM In reply to

    default directory

    Is there a way to make it display files in a preselected directory?  In a program I am making I would like for people to only open a file in a certain directory.  I do not want the common dialog to default to their desktop but to a folder in the applications folder.

    Thank you,
    Joel Strellner
    • Post Points: 0
  • 09-24-2002 12:25 AM In reply to

    • nzjonboy
    • Top 75 Contributor
    • Joined on 11-07-2001
    • Fanatic Member
    • Points 1,230
    if you are using the common dialog control in your app then you can set the initdir property to the folder you want the dialog to default to.

    I think you may need to check the file selected to ensure that it was chosen from the path that your trying to restrict to.

    • Post Points: 0
  • 09-24-2002 1:47 AM In reply to

    Thanks.

    I have decided to do it a different way though.  I am now using a Tree view to list all files in the directory.  It allows a much better interface for what I am trying to accomplish.

    I do have a new problem though.  The main function of the form (frmNewTemplate) is to open a file an put the contents into a rich textbox on the main form (frmMain) but it doesn't seem to be working.  If I put a RichTextBox on the frmNewTemplate it is able to open the file and put it into the RichTextBox correctly but when I change it to be placed into the frmMain it doesn't update the RichTextBox.

    Do have any ideas on how to pass the information from frmNewTemplate to frmMain?

    I have included the code below.  Again it works until the part of updating frmMain.

    Code:


    OpenPath = App.Path & "\templates\"

    OpenFileWName = TreeView1.SelectedItem

    If OpenFileWName = OpenPath Then
    MsgBox "You can not select a directory.  Please select a template file."
    Else
    Open OpenPath & OpenFileWName For Input As #1
       Do Until EOF(1)
       Line Input #1, lineoftext$
           If frmMain.RichTextBox1.Text = "" Then
           alltext$ = lineoftext$
           Else
           alltext$ = alltext$ & vbCrLf & lineoftext$
           End If
       frmMain.RichTextBox1.Text = alltext$
       Loop
    Close #1

    'Unload Me
    End If



    Thank you in advance for any help that you or anyone else may provide.

    Joel Strellner
    • Post Points: 0
  • 12-20-2003 5:20 PM In reply to

    • darkwolf
    • Not Ranked
    • Joined on 12-19-2003
    • New Member
    • Points 30

    path

    is there a way of getting just the path of the file this way, without the file name in it?
    E.G. if i open
    C:\Windows\Wini.ini
    can i get the program to read just
    C:\Windows
    from that?
    • Post Points: 0
  • 12-24-2003 7:58 AM In reply to

    • darkwolf
    • Not Ranked
    • Joined on 12-19-2003
    • New Member
    • Points 30
    Code:
    OpenPath = App.Path & "\templates\"

    OpenFileWName = TreeView1.SelectedItem

    If OpenFileWName = OpenPath Then
    MsgBox "You can not select a directory.  Please select a template file."
    Else
    frmMain.RichTextBox1.LoadFile OpenPath + OpenWFileName
    'Unload Me
    End If


    And it should be as simple as that

    Any idea on my problem? I posted it on here as darkwolf
    • Post Points: 0
  • 04-20-2004 7:45 PM In reply to

    Using the FileName (path) and FileTitle (filename) properties of the dialog control,
    Code:

    Dim FilePathOnly As String

    FilePathOnly = Left(FileName, Len(FileName) - Len(FileTitle))
    'or
    FilePathOnly = Left(FileName, InStrRev(FileName, "\"))

    'or if you use a scripting runtime
    Dim fso As FileSystemObject

    FilePathOnly = fso.GetPath(FileName)
    • Post Points: 0
  • 07-26-2006 9:57 AM In reply to

    • al_sebie
    • Not Ranked
    • Joined on 07-26-2006
    • New Member
    • Points 10

    Common Dialog Control

    Dear Sir

    Thanks for you help and I like you way that you got it, but my questation is Can I use Common Dialog without use File Type? because I need only open folder without select file "Only Folder Path"

    • Post Points: 10
  • 02-20-2007 8:28 PM In reply to

    • ffrreeaakk
    • Not Ranked
    • Joined on 02-20-2007
    • Singapore
    • New Member
    • Points 5

    Re: Common Dialog Control

    I know what you're thinking about. I have exactly the same problem. I don't know how to make Common Dialog Box show such window: http://img230.imageshack.us/img230/7206/selectdirectorytt2.jpg
    • Post Points: 5
Page 1 of 1 (9 items)