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