Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Detect and Remove CAPSLOCK

Status
Not open for further replies.

ZmrAbdulla

Technical User
Apr 22, 2003
4,364
AE
How can I detect and remove CAPSLOCK?
Iam using a SendKeys "Some Text" to Rich Text Box by a click of command button.
SendKeys "Some {enter} Sample {enter}Text {enter} Here" is the complete entry.
So it will be printed to RTB like
Some
Sample
Text
Here

If the CAPSLOCK is on then it will print like
sOME
sAMPLE
tEXT
hERE
I have found some sample codes from other VB sample site that is working well. But the problem is SendKeys are working faster than the code detecting the CAPSLOCK. The code resides in a module to be accessible for all the command buttons.
I need either to pause the SendKeys until it check and remove the CAPSLOCK also to restore the CAPSLOCK so the user may not be knowing something happened or a faster code as a solution.
There are a few threads discussing this in these forums found by a quick search. If anyone can direct me also be appreciated.

Thanks

Zameer Abdulla
Visit Me
 
Take a look into LCase & UCase functions.

Everybody body is somebodys Nutter.
 
>If the CAPSLOCK is on then it will print like

Not here it doesn't...
 
Did you mean to change the text entered to LCase if it was in UCase? It was easy if I am using a TextBox. But I am using a RichTextBox. There must be text present. So how can I change it to LCase? The text already present may be in UCase and I don't want to alter that.


Zameer Abdulla
Visit Me
 
How about

Code:
Dim sText    as string

sText = "Some text"

SendKeys Lcase(sText)

Everybody body is somebodys Nutter.
 
Sorry I just noticed that your text is camel cased. How about looping through the text searching for ASCii keys is a certain range?

Everybody body is somebodys Nutter.
 
I have tried this code in an other PC that prints perfect with CAPSLOCK on. I don't know why my home PC prints the sMALL fIRST?
ClulessChris's Lcase Solution also good for a certain text. It is helpful.
I will try again with home PC.
thanks

Zameer Abdulla
Visit Me
 
Hi,

Further to strongm's post, how are you managing to get it to print like that in the RTB with CAPSLOCK on? Having tried it myself I can't re-create the problem you are facing, CAPSLOCK or not??

Harleyquinn

---------------------------------
For tsunami relief donations
 
The differences in both machines are
HomePC
WinXP/VB6-SP6/Access 2003

Other one
Win 2000 Pro/ VB6 Runtime/ Access 2002
I have tried in Access 2002 with RTB working fine

The one that has full version prints wrong !!! ??
I am still confused..

Zameer Abdulla
Visit Me
 
I tried both in Access and VB6 in both machines Home machine again prints wrong and the other correct !!!


Zameer Abdulla
Visit Me
 
An update to this is, When you try this in the test mode in VB then it prints fine and prints wrong when the app is compiled to EXE!! STRANGE!!
In Access there is no compile mode and it is fine in Access


Zameer Abdulla
Visit Me
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top