Results 1 to 4 of 4

Thread: Common Dialog

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Sep 1999
    Location
    Phoenix, az
    Posts
    1,517
    Im using common dialog with this code,
    and it doesnt work to when the cancel
    button is pressed.

    Code:
            With frmPG.CommonDialog1
                .fileName = sLastSave
                .DialogTitle = "Save State"
                .DefaultExt = ".pcs"
                .Filter = "PicBot Saved State | *.pcs"
                .ShowSave
                If .fileName = "" Then Exit Sub
            End With
    How can I use this code and know when the cancel
    button is pressed?

    [Edited by Evan on 11-26-2000 at 12:52 PM]

  2. #2
    Frenzied Member Vlatko's Avatar
    Join Date
    Aug 2000
    Location
    Skopje, Macedonia
    Posts
    1,409
    Code:
    If frmPG.CommonDialog1.Filename <> 0
    'the user did not press cancel
    End If
    I am become death, the destroyer of worlds.
    mail:[email protected]

    • Visual Basic 6.0 & .NET
    • Visual C++ 6.0 & .NET
    • ASP
    • LISP
    • PROLOG
    • C
    • Pascal

  3. #3
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    Code:
    Private Sub Command1_Click()
    
    On Error GoTo GetOut:
    
    With frmPg.CommonDialog1
                .CancelError = True      'used in cancel code
                .FileName = sLastSave
                .DialogTitle = "Save State"
                .DefaultExt = ".pcs"
                .Filter = "PicBot Saved State | *.pcs"
                .ShowSave
                If .FileName = "" Then Exit Sub
            End With
    Exit Sub
    GetOut:
     Exit Sub 'error 32775 genterated by .CancelError = true
    End Sub
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  4. #4
    Guest
    Or you can use:
    Code:
    If Err <> 32755 Then
        'Cancel was not pressed
    End If

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