Results 1 to 8 of 8

Thread: Disable "X" in the Dialog Box

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Mar 2000
    Location
    bebenia, PA, USA
    Posts
    241

    Post

    I need to be able to disable the "x" the close button in the upper right-hand corner of my dialog box screen; anyone know the code for this or how to do it?

    what happenes is that i have a cancel button to go back to main program and it closes w/o updating the record; however if the user happens to use the "x" instead of cancel the record will update and that leaves a blank or inaccurate record in the database.

    any help would be greatly appreciated, thanks!!!

  2. #2
    Lively Member
    Join Date
    Mar 2000
    Posts
    82

    Post

    in the Form_QueryUnload event you can test to see how the form is being closed:

    if unloadmode = vbformcontrolmenu

    the form is being closed by the x button and you can cancel the form closing by

    cancel = true

    or
    if unloadmode = vbformcode

    the form is being closed by code in the button and proceed
    and allow the form to close

    another idea...
    set the form borderstyle to none

    hope this works for you

    Edited by _bman_ on 03-15-2000 at 01:49 PM

  3. #3
    Junior Member
    Join Date
    Jan 1999
    Location
    Pierre, SD USA
    Posts
    23

    Post

    The following link shows you how to disable the close button via API

    http://www.vb-world.net/tips/tip117.html

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Mar 2000
    Location
    bebenia, PA, USA
    Posts
    241

    Post Disable "X" in the Dialog Box

    i tried boarderless and it did not take away or enable the minimize, maximize and close buttons on the upper-right hand corner of my dialog box. Also, the record is still saving when i use the unloadmode=vbformcontrolmenu even though it is cancelling the form; any ideas how do i disable the "x"; any more ideas; please!!! i even put code in after cancel=true to not update the database to no avail.

    thanks for all help and i already learned something new; cool!!!

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Mar 2000
    Location
    bebenia, PA, USA
    Posts
    241

    Post Disable "X" in the Dialog Box

    okay spoke to soon i put
    if unloadmode=vbformcontrolmenu
    then
    data2.recordset.edit
    data2.recordset.cancelupdate
    cancel=true
    end
    endif

    and it cranks it cancels quits the program and does not update the record and using just the cancel command will bring me back to the form -- thanks big time -- your a genius!!!!!

    It's the little things in life that make the big things easier!!!!

  6. #6
    Hyperactive Member
    Join Date
    Nov 1999
    Posts
    363

    Post

    If you don't need to give your users the minimize/maximize options, you can also set the form's ControlBox to False
    Wade

  7. #7
    Member
    Join Date
    Jan 2000
    Location
    derby,UK
    Posts
    38

    Post

    for them sort of problems go to
    http://www.geocities.com/CollegePark/Library/3001/vblink.html

  8. #8

    Thread Starter
    Addicted Member
    Join Date
    Mar 2000
    Location
    bebenia, PA, USA
    Posts
    241

    Post

    I also found if you set the controlbox property of the form to false you get no minimize, maximize and close button at all a very quick solution!!

    thanks for everything!!!

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