Results 1 to 4 of 4

Thread: CommonDialog --> Save As

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2000
    Posts
    303
    Hi all,

    I am new at this and really don't know how to use a
    dialog box to save a file as. I found a sample to
    open a file, but not a save as.

    Here is a sample code:

    Private Sub Command1_Click()

    ' IS THIS SUPPOSED TO SWITCH TO SAVE AS?

    CommonDialog1.Flags = cdlOFNCreatePrompt

    ' default directory
    CommonDialog1.InitDir = App.Path
    CommonDialog1.Filter = "All Files (*.*)|*.*|Text " & _
    " Files (*.txt)|*.txt|Batch Files (*.bat)|*.bat"
    ' Specify default filter.
    CommonDialog1.FilterIndex = 2

    ' Display the Open dialog box.
    CommonDialog1.ShowOpen
    ' Call the open file procedure.
    ' OpenFile (CommonDialog1.filename)
    fileout = CommonDialog1.FileName

    End Sub


  2. #2
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    I think you should use this instead to save
    CommonDialog1.ShowSave
    although, the dialogs are the same you don't want it to be titled "open file".
    The difference between save and save as isn't the dialog, to show the save dialog is to save as, and the exception of it is save, when you already have the filename. therefore when you choose save you check for the length of the filename property and open it only when it's 0.
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2000
    Posts
    303

    Thanks Kedaman

    You have been very helpful to me. Perhaps someday when
    I know a little more about VB, and make lot$ of money,
    we can meet and have some beer.

    Until then, you make it a good weekend, and thanks again.

  4. #4
    Frenzied Member
    Join Date
    Jun 2000
    Location
    England, Buckingham
    Posts
    1,341
    Dont Get Pissed Though !

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width