Visual Basic 6.0 problem
@Zaphan (710)
Philippines
August 13, 2011 11:56pm CST
I am trying to create an on screen keyboard in visual basic, but I am having problem with these keys, "enter, caps lock" What would be the code when you clicked on the caps command button it will make the text1.text "textbox" to display all capital letters. the same as the enter button?? pls. help me this is an school activity it should be submitted tomorrow. Thank you and god bless
2 responses
@sais06 (1284)
• Philippines
15 Aug 11
Hi Zaphan!
I have actually tried using the keypress event. It worked for the "enter" key but I don't seem to figure out why it's not working with "caps lock". Another option I did is to use the keydown event and it worked perfectly fine to both keys.
Here's actually the sample code I used:
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
Case vbKeyReturn
Text1.Text = "Hello world!"
Case vbKeyCapital
Text1.Text = UCase(Text1.Text)
End Select
End Sub
You might as well try the following sites for additional key codes and samples.
http://www.codeguru.com/forum/archive/index.php/t-31330.html
http://bytes.com/topic/visual-basic/answers/657002-what-keyascii-tab-key
Don't worry these aren't spams.
Good luck!
1 person likes this
@Zaphan (710)
• Philippines
21 Oct 11
Thanks a lot for the information you gave me! it helped a lot.
@vegegirl (828)
• Australia
14 Aug 11
It will probably involve
UCase(my.text1.text) in a little procedure
or you can use UCase (capturedstring) where captured string is a variable that has been assigned the text from the text box.
Look up UCase on the internet as yuou will probably have to put it into a little procedure or sub, and I can' copy or paste into this window, but there heaps of code samples of doing this on the internet.