Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'clears textbox2, just in case you want to do this multiple times.
TextBox2.Text = ""
'an array that will split into 8 different strings (first string = abcABC, second = DEFdef, and so on..)
Dim string1() As String = "abcABC DEFdef GHIghi JKLjkl MNOmno PQRSpqrs TUVtuv WXYZwxyz".Split(" ")
'a simple string that is used to see whether the character in the number needs to be converted, all characters in this string are left untouched
Dim string2 As String = "0123456789-"
' an array that will be used to replace the characters from string1()
Dim string3() As String = "2 3 4 5 6 7 8 9".Split(" ")
'this is the process that will convert the number. It will loop trough every character in textbox1 and replace some if necessary.
For i = 0 To TextBox1.Text.Length - 1
'this check whether the current character in the textbox that the loop is checking, is in string2. If it is in string2, then it will be added to textbox2 without changes
If InStr(string2, TextBox1.Text.Substring(i, 1)) > 0 Then
TextBox2.Text = TextBox2.Text + TextBox1.Text.Substring(i, 1)
Else
'this loop checks trough string1(), in case a character wasn't found in string2.
' the loop will then find the corresponding string of the character found from string1(), from string3(), and put that character (a number) to textbox2.
Dim j As Integer = 0
Do Until InStr(string1(j), TextBox1.Text.Substring(i, 1)) > 0
'same thing as if you would write j = j+1, it basically adds 1 to j for every loop
j += 1
Loop
TextBox2.Text = TextBox2.Text + string3(j)
End If
Next
End Sub