Commondialog Cancel

Discussion in 'AutoCAD' started by KingCAD, Jul 29, 2003.

  1. KingCAD

    KingCAD Guest

    Okay here's what I want to do - I have a program which uses commondialog1.showopen, Now if the user selects cancel in this dialog box I want the entire program to cancel. Silly me I thought it would be as easy as If commondialog1.cancel then bla bla bla. Not happening I get and unknown member error, so there must be another way. I can't even find the commondialog in my help files so any help you could give me would be greatly appreciated.

    Thanks

    Dave.K
     
    KingCAD, Jul 29, 2003
    #1
  2. Here's what I've used... I'm running the CommonDialog class from
    www.acadx.com.

    retVal = oComDlg.ShowSave
    If retVal <= 0 Then 'user cancelled or the API call failed, see
    CommonDialog class
    Exit Sub
    End If

    If you have subroutines calling this one, you'll have to set a return value
    for this sub (maybe make it a function instead of a sub) which depends on
    the return value of the .ShowSave (ShowOpen in your case).

    James
     
    James Belshan, Jul 29, 2003
    #2
  3. KingCAD

    KingCAD Guest

    Thanks James, I'll give that a try. For now i found a simple work around - I am setting a variable to be the file name and path of the file the user selects from the open dialog box, so I simple put -- If StrFileName = "" then CmdCancel_click -- into the initial form's activate event. Now when the user is returned to the initial form, if the variable is "" then no file was selected therefore the user pressed cancel so we execute the CmdCancel Click event. Not sure that's the best way but it works.
    Yhanks again!

    Dave. K
     
    KingCAD, Jul 29, 2003
    #3
  4. A Cancel button hit can be detected via the CancelError property
    (object.CancelError [= boolean]).
    For the control's help file, try looking for C:\WINNT\Help\CMDLG98.CHM.

    --
    John Goodfellow
    irtfnm
    use john at goodfellowassoc dot com


    commondialog1.showopen, Now if the user selects cancel in this dialog box I
    want the entire program to cancel. Silly me I thought it would be as easy as
    If commondialog1.cancel then bla bla bla. Not happening I get and unknown
    member error, so there must be another way. I can't even find the
    commondialog in my help files so any help you could give me would be greatly
    appreciated.
     
    John Goodfellow, Jul 29, 2003
    #4
  5. KingCAD

    KingCAD Guest

    That's what I was looking for. Unfortunately that's not where my help file was, but once you know the name of a file it gets a whole lot easier to find.(C:program Files\Microsoft Visual Studio\MSDN\2001Oct\1033\CMDLG98.CHM)

    Thanks again every body.

    Dave. K
     
    KingCAD, Jul 29, 2003
    #5
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.