473,387 Members | 3,750 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.

Typing application

hi,

I'm new to VB , and I've created a typing program that displays the character pressed and highlights it on the screen. The program displays the characters on a ReadOnly textbox. I could code all characters including the backspace and the enter. The only problem I'm facing right now is how to make the shift key display capital letters ?

I tryed doing it the hard way with an if statement and then cases of all letters , yet it didn't word :(

I know someone can help, and I hope they will

thank you
Mar 3 '08 #1
11 1362
debasisdas
8,127 Expert 4TB
You need to handle the KeyDown event.
Mar 3 '08 #2
that's what I did for all characters. I used the TextBox_KeyDown , how can I use it for the shift key?
Mar 3 '08 #3
QVeen72
1,445 Expert 1GB
Hi,

In KeyUp or KeyDown, Check for "Shift"

Expand|Select|Wrap|Line Numbers
  1. Private Sub Text1_KeyUp(KeyCode As Integer, Shift As Integer)
  2.     If Shift = 1 Then
  3.         MsgBox "Shift Pressed.."
  4.     End If
  5. End Sub
  6.  
Regards
Veena
Mar 3 '08 #4
thanks alot veena, but my problem is:

when the user press the shift key, how can I make the next letter pressed capital ?

I know when the user presses the shift key using this line of code

Case e.keyCode = Keys.ShiftKey

but how can I make it work, that's capilaizing the next letter ?!
Mar 3 '08 #5
QVeen72
1,445 Expert 1GB
Case e.keyCode = Keys.ShiftKey
but how can I make it work, that's capilaizing the next letter ?!
Some thing Like this :

UCase(Chr((e.KeyCode)))

REgards
Veena
Mar 3 '08 #6
how do I apply what you wrote on the next letter ?

should I an if statement ?
Mar 3 '08 #7
QVeen72
1,445 Expert 1GB
Hi,

Declare a Form Level Boolean Variable say, MyShift.
In Key Up Check if Shift is pressed, Make

Expand|Select|Wrap|Line Numbers
  1. If e.keyCode = Keys.ShiftKey Then
  2.    MyShift = Not MyShift 'This Allows you to Toggle Upper and Lower Case
  3. End If
  4.  
And use an If Condition..
If MyShift Then


Regards
Veena
Mar 3 '08 #8
Thank you so much Veena, that worked :)
Mar 3 '08 #9
there's also a minor problem with the Alt key

when the user presses alt, the corresponding button should be highlighted, but because I have a menu strip in my program, pressing the alt key causes the focus to be on the menu strip
Mar 3 '08 #10
QVeen72
1,445 Expert 1GB
Hi,

Yes, that's a bit problem...
One work-around is :
While User Starts Typing, Disable or Hide the Menu.. and Show a Button with "Menu" as caption.
and Trap the "Alt" Key Pressed in Key Down event.
When the user is done typing, and if he wants the menu, then
in Button_Click event , Hide the button and Show the menu..
Little bit of coding is involved..

REgards
Veena
Mar 3 '08 #11
thanks alot you've been a great help
Mar 3 '08 #12

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

Similar topics

53
by: dterrors | last post by:
Will php 6 do strong typing and/or namespaces? I was shocked to find out today that there are some people who actually argue that weak typing is somehow better. I didn't even know there was a...
12
by: Michael Muller | last post by:
Is there currently any plan to introduce static typing in any future version of Python? (I'm not entirely sure that "static typing" is the right term: what I'm talking about is the declaration of...
467
by: mike420 | last post by:
THE GOOD: 1. pickle 2. simplicity and uniformity 3. big library (bigger would be even better) THE BAD:
12
by: Jason Tesser | last post by:
I work for at a college where I am one of 2 full-time developers and we are looking to program a new software package fro the campus. This is a huge project as it will include everything from...
15
by: Premshree Pillai | last post by:
How do I force static typing in Python? -Premshree Pillai ===== -Premshree http://www.qiksearch.com/] ________________________________________________________________________ Yahoo! India...
94
by: Gabriel Zachmann | last post by:
Is it correct to say that strong/weak typing does not make a difference if one does not use any pointers (or adress-taking operator)? More concretely, I am thinking particularly of Python vs C++....
49
by: bearophileHUGS | last post by:
Adding Optional Static Typing to Python looks like a quite complex thing, but useful too: http://www.artima.com/weblogs/viewpost.jsp?thread=85551 I have just a couple of notes: Boo...
1
by: riscy | last post by:
I'm having odd behaviour of VS 2003 pro recently. It happen when Dell 9200 returned from repairs with new motherboard to fix audio out socket problem (as they say). I installed Visual Assist X and...
6
by: samslists | last post by:
Hi... I want to write a program that will let me know after thirty minutes of typing that I need to take a five minute typing break. But when I stop typing it's smart enough to pause the 30...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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
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.