how to disable the alt+F4 key for the windows form

By samohod26 ·
i want to disable the form option alt+F4 key due to which it is closing my form,the form is login form in my application.

I need the solution for this problem.

This conversation is currently closed to new comments.

4 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Collapse -

That's not what you do

by Tony Hopkinson In reply to how to disable the alt+F4 ...

Don't know what language you are using

if (myLoginForm.ShowModal == mrOK)
{ // check user name and password
// if not valid exit the application and}
// exit the application;

Otherwise the would have to login before they could could log out and exit.

Collapse -

Using javascript disable the alt+F4 key windows form

by starwin_ms In reply to how to disable the alt+F4 ...

<script type="text/javascript">
var altDown=0;
if (typeof window.event != 'undefined'){
document.onkeydown = function(){
if(event.keyCode == 18)altDown=1;
if(event.keyCode == 115&&altDown==1)
altDown = 0;

Collapse -

Disable the functionality of Alt F4 key combination

by suscriber07.siva In reply to how to disable the alt+F4 ...

The following code will disable the functionality of Alt+F4 key in ur Form

Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
e.Cancel = True
End Sub

Back to Windows Forum
4 total posts (Page 1 of 1)  

Operating Systems Forums