I mean the small exit/cancel button marked with an X in the top right hand corner. I want to implement a Logon dialog box that accepts a username/password so obviously I don't want the user to be able to dismiss the modal pop up. If it is not possible to remove or disable the button then is there some way I can intercept the closing event and stop it closing?
Asked
Active
Viewed 7,918 times
4 Answers
29
You can use the HasCloseButton property of the ChildWindow to hide the close button.
Please let me know if this helps.
Ezequiel Jadib

Ezequiel Jadib
- 14,767
- 2
- 38
- 43
-
I'd like to note that this property is not listed in the property view of the design view. You have to go in to your code and type it in (like Me.HasCloseButton = False) – Jared Mark May 31 '12 at 04:55
2
The code below prevents a ChildWindow from ever closing, effectively disabling the X button. Modify to suit your business logic.
protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
{
base.OnClosing(e);
e.Cancel = true;
}
1
HasCloseButton="False" ..
This property used to hide the 'X' button In ChildWindow

kleopatra
- 51,061
- 28
- 99
- 211

Kathiravan
- 11
- 1
1
Select child window and Press F4. It will show the property window. Then goto HasCloseButton property and uncheck the checkbox.
Enjoy