PC Review


Reply
Thread Tools Rate Thread

Can I get Keyboard data not using Controls?

 
 
Ken Soenen
Guest
Posts: n/a
 
      5th Dec 2005
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.


 
Reply With Quote
 
 
 
 
Héctor Miguel
Guest
Posts: n/a
 
      6th Dec 2005
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.


 
Reply With Quote
 
Ken Soenen
Guest
Posts: n/a
 
      6th Dec 2005
Thanks Hector. I appreciate your time spent.

"Héctor Miguel" <(E-Mail Removed)> wrote in message
news:eCcOoZk%(E-Mail Removed)...
> 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.
>



 
Reply With Quote
 
Héctor Miguel
Guest
Posts: n/a
 
      6th Dec 2005
hi, Ken !

> ... I appreciate your time spent.


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

regards,
hector.


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
keyboard controls =?Utf-8?B?TGVzbGll?= Microsoft Excel Misc 4 12th Aug 2008 11:24 PM
Data and controls from dynamically added controls is rmoved on Submit David Hubbard Microsoft ASP .NET 2 17th Jan 2006 06:52 PM
Keyboard Volume Controls Clay Windows XP Setup 0 24th Feb 2004 05:56 PM
How to use data controls to display data in data bound controls? yma Microsoft VB .NET 5 16th Dec 2003 09:09 AM
RadioButton and Keyboard Controls Sean Microsoft ASP .NET 1 29th Jul 2003 10:18 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:29 PM.