Click here to Skip to main content
11,583,555 members (63,384 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: VB.NET
Hi friends
i write a code like

    Private Sub flash_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
        If e.KeyCode = Keys.Escape Then
        End If
    End Sub
In the code is work.But when i drag and drop the shack wave flash object control on form designing after i run the form the above code does not work.How can i rectify this problem???
Advance thanks to all.....
Posted 5-Nov-12 7:47am
Edited 5-Nov-12 7:56am
Sergey Alexandrovich Kryukov at 5-Nov-12 13:50pm
"Does not work" is not informative enough. What exactly the problem is? And what is "Me" here? A form? Why closing it in this strange way? If this is a modal window, it's closed by itself; you need to have CancelButton.
SPprasath at 5-Nov-12 14:01pm
Thank u....
Sergey Alexandrovich Kryukov at 5-Nov-12 14:37pm
You are welcome.
If you agree that my answer makes sense, please accept it formally (green button) -- thanks.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

This is not a good way to close a window. If you show a window as modal (via ShowDialog), you need to use CancelButton; and the form will close itself on escape:[^].

And if the form is not modal, you should never close it with Escape, as it will violated expected UI style and can cause loss of user's work, by apparent reasons.


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 430
1 Dave Kreskowiak 230
2 Richard Deeming 220
3 Sergey Alexandrovich Kryukov 220
4 virusstorm 203
0 OriginalGriff 1,523
1 Sergey Alexandrovich Kryukov 995
2 Abhinav S 696
3 Dave Kreskowiak 621
4 Suvendu Shekhar Giri 568

Advertise | Privacy | Mobile
Web04 | 2.8.150603.1 | Last Updated 5 Nov 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100