Results 1 to 4 of 4

Thread: Common Dialog control

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Sep 2002
    Location
    Cape Town, SA
    Posts
    144

    Common Dialog control

    Hi
    I am using a cdc control in an app. How do I pick up if the user has pressed the cancel button?
    Thanking you in advance
    PORRASTAR

  2. #2
    Hyperactive Member Dmitri K's Avatar
    Join Date
    Sep 2002
    Location
    West Palm Beach, FL
    Posts
    444
    the return string is "" if cancel is pressed

  3. #3
    PowerPoster MidgetsBro's Avatar
    Join Date
    Oct 2000
    Location
    Apparently, Internet.com
    Posts
    3,125
    A better way to do it:
    VB Code:
    1. On Error GoTo EH:
    2. CommonDialog1.CancelError = True
    3. 'do your cd code here
    4. CommonDialog1.ShowOpen
    5. 'etc
    6.  
    7. Exit Sub
    8. EH:
    9. If Err.Number = 32755 Then
    10.   'Cancel was pressed
    11. End If

    Just make sure the CancelError property is set to true. You can set it at design time and take the first line of the code out where it sets it to true.
    <removed by admin>

  4. #4
    Software Eng. Megatron's Avatar
    Join Date
    Mar 1999
    Location
    Canada
    Posts
    11,286
    In this case, where you don't really need to "handle" the error, you could just use the On Error Resume Next statement.

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