+ Reply to Thread
Results 1 to 4 of 4

Can I get Keyboard data not using Controls?

Hybrid View

  1. #1
    Ken Soenen
    Guest

    Can I get Keyboard data not using Controls?

    Is there any way I can detect a keyboard event while a Form is open, WITHOUT
    having to use the keyboard event handlers from the Control that has the
    Focus?

    For Example:

    Let's say I have Form that has only one Control, say a Textbox, and this
    Textbox is DISABLED so it can't take the Focus and receive keyboard events.
    Can I still somehow get the data coming from the keyboard and say, put it in
    a String. Of course, if the textbox were enabled and had the focus, I would
    want the data to ALSO go in the Textbox as it normally would.

    Thanks for any thoughts.



  2. #2
    Héctor Miguel
    Guest

    Re: Can I get Keyboard data not using Controls?

    hi, Ken !

    > Is there any way I can detect a keyboard event while a Form is open
    > WITHOUT having to use the keyboard event handlers from the Control that has the Focus?
    > Let's say I have Form that has only one Control, say a Textbox, and this Textbox is DISABLED
    > so it can't take the Focus and receive keyboard events.
    > Can I still somehow get the data coming from the keyboard and say put it in a String.
    > Of course, if the textbox were enabled and had the focus
    > I would want the data to ALSO go in the Textbox as it normally would...


    you can get keyboard events from the form itself [assuming only one textbox control AND disabled]...
    just play with other events rather double-clicking the form...
    === in the form code module ===
    Dim CharsFromForm As String
    Private Sub UserForm_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
    TextBox1 = CharsFromForm
    CharsFromForm = ""
    End Sub
    Private Sub UserForm_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
    CharsFromForm = CharsFromForm & Chr(KeyAscii)
    End Sub

    hth,
    hector.



  3. #3
    Ken Soenen
    Guest

    Re: Can I get Keyboard data not using Controls?

    Thanks Hector. I appreciate your time spent.

    "Héctor Miguel" <NOhemiordiSPAM@PLShotmail.com> wrote in message
    news:eCcOoZk%23FHA.1032@TK2MSFTNGP09.phx.gbl...
    > hi, Ken !
    >
    >> Is there any way I can detect a keyboard event while a Form is open
    >> WITHOUT having to use the keyboard event handlers from the Control that
    >> has the Focus?
    >> Let's say I have Form that has only one Control, say a Textbox, and this
    >> Textbox is DISABLED
    >> so it can't take the Focus and receive keyboard events.
    >> Can I still somehow get the data coming from the keyboard and say put it
    >> in a String.
    >> Of course, if the textbox were enabled and had the focus
    >> I would want the data to ALSO go in the Textbox as it normally would...

    >
    > you can get keyboard events from the form itself [assuming only one
    > textbox control AND disabled]...
    > just play with other events rather double-clicking the form...
    > === in the form code module ===
    > Dim CharsFromForm As String
    > Private Sub UserForm_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
    > TextBox1 = CharsFromForm
    > CharsFromForm = ""
    > End Sub
    > Private Sub UserForm_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
    > CharsFromForm = CharsFromForm & Chr(KeyAscii)
    > End Sub
    >
    > hth,
    > hector.
    >




  4. #4
    Héctor Miguel
    Guest

    Re: Can I get Keyboard data not using Controls?

    hi, Ken !

    > ... I appreciate your time spent.


    hope that helped you, and i appreciate your feed-back.

    regards,
    hector.



+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1