wasimking
Member
- Joined
- May 21, 2012
- Messages
- 5
- Programming Experience
- 1-3
Hello I want To remove one character from from one textbox with backspace and it will remove more than one character from other textbox
if i remove "b" from textbox1 it should automaticaly remove "king" from second texbox
and error is "Index and count must refer to a location within the string.Parameter name: count"
the world length is same means if enter "c" it will generate 4 character word with one space in textbox2
this is code
Private Sub txtInput_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtInput.KeyPress
Dim len2 As Integer
len2 = txtCode.Text.Length
If (Asc(e.KeyChar) = 65 Or Asc(e.KeyChar) = 97) Then
txtCode.Text += "Acer" & " "
ElseIf (Asc(e.KeyChar) = 66 Or Asc(e.KeyChar) = 98) Then
txtCode.Text += "King" & " "
ElseIf (Asc(e.KeyChar) = 8) Then
Try
txtCode.Text = txtCode.Text.Remove(len2 - 4, len2)
Catch ex As Exception
MsgBox(ex.Message)
End Try
End If
End Sub
if i remove "b" from textbox1 it should automaticaly remove "king" from second texbox
and error is "Index and count must refer to a location within the string.Parameter name: count"
the world length is same means if enter "c" it will generate 4 character word with one space in textbox2
this is code
Private Sub txtInput_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtInput.KeyPress
Dim len2 As Integer
len2 = txtCode.Text.Length
If (Asc(e.KeyChar) = 65 Or Asc(e.KeyChar) = 97) Then
txtCode.Text += "Acer" & " "
ElseIf (Asc(e.KeyChar) = 66 Or Asc(e.KeyChar) = 98) Then
txtCode.Text += "King" & " "
ElseIf (Asc(e.KeyChar) = 8) Then
Try
txtCode.Text = txtCode.Text.Remove(len2 - 4, len2)
Catch ex As Exception
MsgBox(ex.Message)
End Try
End If
End Sub