Splitting each letter in a textbox

bluejaguar456

Well-known member
Joined
Aug 22, 2006
Messages
47
Hey Guys,

I have been having a few problems trying to get all the letters in a textbox to split.

I want to get any letters that the user types in a textbox to be split into each different letter.

The end result will be that i can check each letter and cross reference it with a number.

E.G. r returns 32, e returns 54

This is going to be done for every letter that the user types,

Any help would be great appreciated! Thanks.
 
Im not sure, but you should be able to attach to the TextBox.KeyPressed Event which sould give you the keycode of the key that was pressed.
 
substring keyword is for spliting the string.
and use ascii function to determine the ascii value...
 
If you want to do all the processing after the user is finished typing (not using an event like I mentioned earlier).

You may use a foreach loop like this.

Code:
foreach(char c in yourTextBox.Text)
    // perform action on c
 
is it possible to check each letter int eh order typed afterwards?

e.g user types: hello

i then check for the h then the e then the l and so in order?

thanks
 
Is this what you are looking for:

Code:
        Dim TheChars() As Char = TextBox1.Text.ToCharArray()
        For Each TmpChar In TheChars
            Debug.Print(TmpChar & " = " & Asc(TmpChar))
        Next
 
This code can help u

char[] textValue = textBox1.Text.ToCharArray();
foreach (char c in textValue)
lblAsciiValue.Text += (int)(c);
 

Similar threads

D
Replies
0
Views
128
Developer Dude
D
F
Replies
0
Views
120
Francesco2017
F
R
Replies
0
Views
230
Ruslan Indra
R
Back
Top