|
-
June 25th, 2007, 10:08 AM
#1
Adding Letters
I have and application that requires me to add letters. So if I have an A I need the next values to be B and so on. Any ideas how this works. I am using a text box to store me letter.
-
June 25th, 2007, 11:49 AM
#2
Re: Adding Letters
You could try this Nate :
Code:
Public Class Form1
Private strEnteredLet As String 'get entered letter
Private kEnteredKeyCode As Integer 'get keycode of entered letter
Private strAddLet As String 'get key code of following ( next ) letter
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
TextBox1.SelectionStart = 2 'start selection here
TextBox1.SelectedText = strAddLet 'add this in selection
End Sub
Private Sub TextBox1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
strEnteredLet = TextBox1.Text 'store entered text
kEnteredKeyCode = e.KeyCode + 1 'get next keycode
strAddLet = ChrW(kEnteredKeyCode) 'convert to readable format ( otherwise will show number, not letter )
End Sub
End Class
Once I click on a button, the next letter in the sequence will show 
I've also assumed that you wanted only Uppercase letters, so I set my CharacterCasing property of my textbox to Uppercase.
I hope it helps!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|