473,403 Members | 2,293 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

Caps Key

hi friends,
this is senny, here i have to solve my pbm thrugh ur kind suggestion.In my project ,i have to restrict the user to use "CAPS KEY" like when we go to login if caps pressed the msbbox is come with msg "caps key pressed".

thanks in advance
senny
Mar 26 '07 #1
8 5091
ansumansahu
149 100+
hi friends,
this is senny, here i have to solve my pbm thrugh ur kind suggestion.In my project ,i have to restrict the user to use "CAPS KEY" like when we go to login if caps pressed the msbbox is come with msg "caps key pressed".

thanks in advance
senny
Hi ,

If the CAPS LOCK is on and one trys to enter data then we can trap the Ascii code of the keys pressed and then display an message that CAPS letters are not allowed.

thanks
ansuman
Mar 26 '07 #2
cmrhema
375 256MB
Hi ,

If the CAPS LOCK is on and one trys to enter data then we can trap the Ascii code of the keys pressed and then display an message that CAPS letters are not allowed.

thanks
ansuman
As put up by ansuman try trapping the ascii code of keys
A carries an ascii code of 65 it continues till Z which has the ascii code of 90
Put an condition in keypress event
If KeyAscii >= 65 And KeyAscii <= 90 Then
Text1.Locked = True
Msgbox "CAPS ON"
Else
Text1.Locked = False
End If
Mar 26 '07 #3
Killer42
8,435 Expert 8TB
hi friends,
this is senny, here i have to solve my pbm thrugh ur kind suggestion.In my project ,i have to restrict the user to use "CAPS KEY" like when we go to login if caps pressed the msbbox is come with msg "caps key pressed".
Have a look at this link... How To Toggle the NUM LOCK, CAPS LOCK, and SCROLL LOCK Keys. Specifically, I think you'll be interested in the GetKeyboardState function.
Mar 27 '07 #4
As put up by ansuman try trapping the ascii code of keys
A carries an ascii code of 65 it continues till Z which has the ascii code of 90
Put an condition in keypress event
If KeyAscii >= 65 And KeyAscii <= 90 Then
Text1.Locked = True
Msgbox "CAPS ON"
Else
Text1.Locked = False
End If

THIS DOESN'T WORK IF USER IS TYPING BYPRESSING SHIFT KEY
Mar 27 '07 #5
cmrhema
375 256MB
THIS DOESN'T WORK IF USER IS TYPING BYPRESSING SHIFT KEY
This WORKS even if user is typing by pressing shift key
Here the key Caps or Shift(in my code) is immaterial. All the code does is traps the ascii value in the IFfunction . So irrespective of of SHIFT or CAPS it will work.
I have verified it.
Mar 27 '07 #6
SammyB
807 Expert 512MB
hi friends,
this is senny, here i have to solve my pbm thrugh ur kind suggestion.In my project ,i have to restrict the user to use "CAPS KEY" like when we go to login if caps pressed the msbbox is come with msg "caps key pressed".

thanks in advance
senny
Senny, Killer is absolutely correct: For VBA and VB6, you need to use the GetKeyboardState api. (thanks, Killer, for the link! I added it to Favorites)

However, it is much easier in VB.NET, you just use the Control class:
Expand|Select|Wrap|Line Numbers
  1. If Control.IsKeyLocked(Keys.CapsLock) Then _
  2.     MsgBox("CAPS LOCK is ON!", MsgBoxStyle.Exclamation)
See, VB.DotNet really is nicer! ;) --Sam
Mar 27 '07 #7
Killer42
8,435 Expert 8TB
This WORKS even if user is typing by pressing shift key
Here the key Caps or Shift(in my code) is immaterial. All the code does is traps the ascii value in the IFfunction . So irrespective of of SHIFT or CAPS it will work.
I have verified it.
I think the basic problem here is that it won't tell you if the capslock key is down. All it will tell you is that an uppercase key was typed - however that happened.

The original poster was not looking for how to tell if an uppercase letter is typed. They wanted to be able to warn that the capslock is down - you know, the way Windows XP does at password entry.
Mar 27 '07 #8
cmrhema
375 256MB
I think the basic problem here is that it won't tell you if the capslock key is down. All it will tell you is that an uppercase key was type - however that happened.

The original poster was not looking for how to tell if an uppercase letter is typed. They wanted to be able to warn that the capslock is down - you know, the way Windows XP does at password entry.
I understood now. Went through your link. Wonderful article
Thanks killer
Mar 28 '07 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

18
by: Robert | last post by:
Hi! I was wondering if the was any way to determine the state of the caps lock key, on or off. Of course I can capture the key events and see whether the caps lock is pressed, but that does not...
4
by: Peter D | last post by:
I have a second hand bar code reader (keyboard wedge) en i can read the bar codes but after every scan he turns my caps lock on. (GRRRRRR). I search a code to turn my caps lock off or can anyone...
20
by: Malcolm | last post by:
Use all lower case for ansi c functions, and Capitalise For Platform-Specific. If you call something with caps, then your function name requires caps itself.
3
by: Mike L | last post by:
How do I turn Caps Lock on, when my form opens?
7
by: John A Grandy | last post by:
does anyone know of an intrinsic .NET function , or font , or other mechanism , to do "proper-case all-caps" ... ? so, for a name like "Arnold Schwarzenegger" ... .... I want it entirely in...
1
by: charlies224 | last post by:
Hi, I am writting a software that requires me to make sure the Num Lock is always on and Caps Lock is always off. First, I know how to detect if Num Lock or Caps Lock is on or off (if...
2
by: Fred's | last post by:
Hi Folks, I've been trying to figure out how can I see the text in caps in my report, but til now, nothing works. Does anyone knows how can I makes the text in caps in my report? Your...
9
by: trondhuso | last post by:
Hi, I have a solution that - at time of writing - has to use tables to render a list of database-results. My challenge though is that we have used iframes and such to render the different lists...
18
by: DanicaDear | last post by:
I want to use all caps in a database. I desire to show all caps AS YOU TYPE regardless of how the keyboard/caps lock is set. I tried to format my form field with an on-click event…and this is the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.