473,387 Members | 1,540 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,387 software developers and data experts.

Change Case

I have created a keyboard program i am using a textbox as the output and buttons for the input. is there anyone who knows hw i could use the caps lock feature

i am currently tryin 2 use a check box however the problem arises after i uncheck the box because if i pres another button the letters still apear in CAPITALS
Nov 6 '07 #1
11 1484
YarrOfDoom
1,247 Expert 1GB
can you give the piece of code that handles the capitals?
it would help very much
Nov 6 '07 #2
Well so far I have come up with this code:
but again when I unchek the chekbox everything in the text box turns to lowercase:


Expand|Select|Wrap|Line Numbers
  1. Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
  2.         If Me.CheckBox1.Checked = True Then
  3.             Me.TextBox1.CharacterCasing = CharacterCasing.Normal
  4.         End If
  5.         If Me.CheckBox1.Checked = False Then
  6.             Me.TextBox1.CharacterCasing = CharacterCasing.Lower
  7.         End If
  8.     End Sub
Nov 6 '07 #3
YarrOfDoom
1,247 Expert 1GB
If your trying to simulate a caps-button, I would use something like this:

Expand|Select|Wrap|Line Numbers
  1. Private Sub button_a() Handles button_a.Click
  2. if checkbox1.checked = true then
  3. textbox1.text = textbox1.text & "A"
  4. else
  5. textbox1.text = textbox1.text & "a"
  6. end if
  7. end sub
This for all of your buttons.

Yarr
hint: use code-tags, it helps people reading your code
Nov 6 '07 #4
kadghar
1,295 Expert 1GB
If your trying to simulate a caps-button, I would use something like this:

Expand|Select|Wrap|Line Numbers
  1. Private Sub button_a() Handles button_a.Click
  2. if checkbox1.checked = true then
  3. textbox1.text = textbox1.text & "A"
  4. else
  5. textbox1.text = textbox1.text & "a"
  6. end if
  7. end sub
This for all of your buttons.

Yarr
hint: use code-tags, it helps people reading your code
in this case, wouldnt it be easier to write in the keypress event something like

if checkbox1.checked = true then keyascii = asc(ucase(chr(keyascii)))

Instead of writing a case for each key

HTH
Nov 6 '07 #5
YarrOfDoom
1,247 Expert 1GB
in this case, wouldnt it be easier to write in the keypress event something like

if checkbox1.checked = true then keyascii = asc(ucase(chr(keyascii)))

Instead of writing a case for each key

HTH
I don't think it's usefull in this case, because he is using buttons on a form for the typing, he's create something like "on-screen keyboard"
Nov 6 '07 #6
kadghar
1,295 Expert 1GB
Ô_o wait a sec

was it checkbox1.checked or checkbox1.value??

Well if you have troubles with one of them, try the other.
Nov 6 '07 #7
YarrOfDoom
1,247 Expert 1GB
Well so far i have come up with this code:
but again when i unchek the chekbox everything in the text box turns to lowercase


Expand|Select|Wrap|Line Numbers
  1. Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
  2. If Me.CheckBox1.Checked = True Then
  3. Me.TextBox1.CharacterCasing = CharacterCasing.Normal
  4. End If
  5. If Me.CheckBox1.Checked = False Then
  6. Me.TextBox1.CharacterCasing = CharacterCasing.Lower
  7. End If
End Sub
Actually, there's nothing wrong with this code, but it's the logic behind it that is wrong.
Nov 6 '07 #8
Killer42
8,435 Expert 8TB
Actually, there's nothing wrong with this code, but it's the logic behind it that is wrong.
Yes, this code says to convert whatever is currently in the textbox to upper or lower case. What you actually need to do is check the current setting of the checkbox before adding each character.
Nov 7 '07 #9
kadghar
1,295 Expert 1GB
I don't think it's usefull in this case, because he is using buttons on a form for the typing, he's create something like "on-screen keyboard"
i see, but it depends on how he is doing it. anyway, it can be written in the keypress event of the form.

or when the checkbox is checked, in the keydown event of the form, if the keycode is between 65 and 90, then it puts chr(keycode) in the textbox.
Nov 7 '07 #10
Killer42
8,435 Expert 8TB
i see, but it depends on how he is doing it. anyway, it can be written in the keypress event of the form...
I think the point yarr was making is that no keyboard events will be happening, since the user is just clicking the mouse.
Nov 7 '07 #11
kadghar
1,295 Expert 1GB
I think the point yarr was making is that no keyboard events will be happening, since the user is just clicking the mouse.
oh, i see... sorry, hadnt understand.
Nov 7 '07 #12

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

Similar topics

8
by: kchengso | last post by:
One of my printers in my printer.devicename call returns in lower case. Is it possible for me to change it to upper case? I am also wondering how, in the first place, this particular printer...
2
by: Nick Calladine | last post by:
Is this possible to ... I wish to get the value of a dropdown select but gets is indexable value (dont know if that is the right term) if that is possible (the position it assigned get assigned...
1
by: Richard Holliingsworth | last post by:
Hello: The group has new 'standards' for online forms and I need to change the 'style' of my existing forms (A2002). Can I do this? I can't find a way using the GUI or the properties. ...
2
by: MLH | last post by:
What's the simplest way to allow a user of an A97 app to change password?
2
by: Imran Aziz | last post by:
Hello All, I want to change the size of my hyper lnks in a repeater control dynamially using the onItemBound event, as under, but cannot seem to understand how to alter the properties to do...
6
by: Jan | last post by:
Hi: I have created a secured database for a client. For various reasons, I don't want the client to have full persmissions for the database; they aren't in the admins group. I have instead tried...
1
by: Sankalp | last post by:
Hi, I am using VB 2005. My application has many data bound controls. The connection is stored in the app.config file. I want the application to start with a default connection string and while...
2
by: Denis | last post by:
How can you get the contents of a text box to change after for click out of it. Eg I have a text box on a form called Ownername. If some one enters a name in lower case that it automatically...
130
by: Gianni Mariani | last post by:
Attached example CPP files makes it easier to post code and extract code from posts. It's unimaginable at this time where virtually any news reader is capable of dealing with attachments to stick...
56
by: Adem | last post by:
C/C++ language proposal: Change the 'case expression' from "integral constant-expression" to "integral expression" The C++ Standard (ISO/IEC 14882, Second edition, 2003-10-15) says under...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.