My application is parent, child application. Child forms shows then press cntrl + F4
the child form is closed. How to block the action and the same time if i press cntrl + F
4 the child form have submit button that event is invoked.
How can i do that?
I am using below coding is block the control + F4
Protected Overrides Function ProcessCmdKey(ByRef msg As Message, ByVal keyData As Keys) As Boolean
If keyData = Keys.Control Or Keys.F4 Then Return True
Return MyBase.ProcessCmdKey(msg, keyData)
End Function
This event already exists, the FormClosing event fires. You can cancel the close by setting e.Cancel = True in your event handler for the event. Be sure to check the e.CloseReason before you do that.
Do avoid breaking standard Windows shortcut keystrokes, there is no point. The user can also close the window by clicking the child window's Close button. Ctrl+F4 is just a helpful shortcut to do the same thing without using the mouse.