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.
Printable View
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.
You could try this Nate :
Once I click on a button, the next letter in the sequence will show :)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
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! :)