dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: Detecting clicking the Cancel Button using common dialog controls

  1. #1
    Join Date
    Mar 2001
    Posts
    38

    Detecting clicking the Cancel Button using common dialog controls

    Hi,

    I want to exit a sub if a user hits the cancel button in a save/open dialog. How do I do it????


  2. #2
    Join Date
    Sep 1999
    Location
    France
    Posts
    393

    Re: Detecting clicking the Cancel Button using common dialog controls

    you use CommonDialiog.ShowOpen function to display your dialog?

    if yes, just after the call to ShowOpen test if
    CommonDialog.FileName = ""
    if yes it's because cancel have been pressed or because the user has exited the dialog without selecting a file.




  3. #3
    Join Date
    Feb 2000
    Posts
    149

    Re: Detecting clicking the Cancel Button using common dialog controls

    Set the cancelerror to true, and then add code for exiting the sub on your on error goto...


  4. #4
    Join Date
    Apr 2000
    Location
    South Carolina,USA
    Posts
    2,210

    Re: Detecting clicking the Cancel Button using common dialog controls


    CommonDialog1.CancelError = true
    CommonDialog1.ShowOpen
    If Err.Number <> 0 then Exit Sub





    John G

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)