Members

Technology Zones

IBM Learning Center

Articles

Hosted By

MaximumASP

Info

Rated
Read 103,364 times

Contents

Related Categories

Common Dialog Control - Using the Control

Using the Control

To show one of the dialog boxes contained in the Common Dialog control, you need to use the following syntax:

CommonDialog1.DialogBox

Where DialogBox is one of the following methods (the methods in italic are not covered in this article):

Method Action
ShowSave Displays the Save Dialog
ShowOpen Displays the Open Dialog
ShowPrinter Displays the Print Dialog
ShowColor Displays the Colour Dialog
ShowHelp Displays the Help Dialog
ShowFont Displays the Font Dialog

As you can see, it is very easy to user the Common Dialog Control. However, in order to use the control to its full potential, you need to set a few parameters before showing the dialog. These parameters will be different, depending on which dialog you want to show. The next few sections describe them.

James first started writing tutorials on Visual Basic in 1999 whilst starting this website (then known as VB Web). Since then, the site has grown rapidly, and James has written numerous tutorials, articles and reviews on VB, PHP, ASP and C#. In October 2003, James formed the company Developer Fusion Ltd, which owns this website, and also offers various development services. In his spare time, he's a 3rd year undergraduate studying Computer Science in the UK. He's also a Visual Basic MVP.

Comments

  • Re: Common Dialog Control

    Posted by ffrreeaakk on 20 Feb 2007

    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://Common Dialog Control

    Posted by al_sebie on 26 Jul 2006

    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 "Onl...

  • Posted by takedownca on 20 Apr 2004

    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
    FilePath...

  • Posted by darkwolf on 24 Dec 2003

    [code]OpenPath = App.Path & "\templates\"

    OpenFileWName = TreeView1.SelectedItem

    If OpenFileWName = OpenPath Then
    MsgBox "You can not select a directory. Please select a template file."
    E...

  • path

    Posted by darkwolf on 20 Dec 2003

    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?