Windows Vista Forums

Key preview
  1. #1


    a Guest

    Key preview

    Dear I all

    I want if I press F4 key the form close

    I set the key preview to true

    But I ask where can I put code like this and is this code good or not

    I mean what the events needed to put code like this

    ==============================

    If e.keycode = Keys.F4 Then

    Me.Close()



    End If

    =====================



      My System SpecsSystem Spec

  2. #2


    Jan Hyde (VB MVP) Guest

    Re: Key preview

    "a" <a@xxxxxx>'s wild thoughts were released on Thu, 19 Jun
    2008 15:48:41 +0300 bearing the following fruit:

    >Dear I all
    >
    >I want if I press F4 key the form close
    >
    >I set the key preview to true
    >
    >But I ask where can I put code like this and is this code good or not
    >
    >I mean what the events needed to put code like this
    >
    >==============================
    >
    >If e.keycode = Keys.F4 Then
    >
    >Me.Close()
    >
    >End If
    >
    >=====================
    I can't help wonder why you need to do this, ALT+F4 is the
    windows standard for closing a form, and should work for you
    already. Are you specifically trying to avoid having to use
    the ALT key?

    --
    Jan Hyde

    https://mvp.support.microsoft.com/profile/Jan.Hyde

      My System SpecsSystem Spec

Key preview problems?

Similar Threads
Thread Thread Starter Forum Replies Last Post
Preview Riptorn General Discussion 22 03 Aug 2009
Preview Kris .NET General 1 30 Jan 2009
Unable to preview office documents in the preview pane BBA Vista file management 13 28 Nov 2007
Tell preview pane to... preview a known "normal" text file PMPP Vista file management 3 17 Nov 2007
fax preview William Vista print fax & scan 0 29 Mar 2007