CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2024
    Posts
    1

    Can't catch Common Dialog box Cancel button

    I have searched for the answer to this but the typical response to catch when a common dialog box is shown with the showsave or showopen and the user hits cancel it ignores my on error goto statement. It throws the error and the project goto debug mode.

    On Error GoTo ErrHandler
    CommonDialog1.CancelError = True
    CommonDialog1.DialogTitle = MSG66
    CommonDialog1.FilterIndex = 1
    CommonDialog1.DefaultExt = "xlsx"
    CommonDialog1.Filter = "Excel (*.xlsx)|*.xlsx|(*.xls)|*.xls|All Files (*.*)|*.*"
    CommonDialog1.InitDir = path
    CommonDialog1.FileName = path & "AuditorRecap"
    'CommonDialog1.CancelError = True
    CommonDialog1.FLAGS = FileOpenConstants.cdlOFNOverwritePrompt + FileOpenConstants.cdlOFNHideReadOnly
    'Show the dialog box
    CommonDialog1.ShowSave -> user hits cancel and project throws the prompt with Run-time error 32755, cancel was selected with the End and Debug buttons. Hit debug and it is on this line

    I have noted that the past posts on this were using the Common Dialog Box with SP3. I am on SP6 so that is a difference.

    Any clues?

  2. #2
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,867

    Re: Can't catch Common Dialog box Cancel button

    You'll probably get better responses on this site's sister site vbforums
    https://www.vbforums.com/forumdispla...-6-and-Earlier
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

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

Featured