anyone know how to do the backspace coding?
example.
textbox1.text with abc
i click a button it remove "c"
i click again it remove "b"
i click again it remove "a"
something like this?
anyone know how to do the backspace coding?
example.
textbox1.text with abc
i click a button it remove "c"
i click again it remove "b"
i click again it remove "a"
something like this?
See if this helps.
'// Give focus to TextBox and Send the BackSpace key.
TextBox1.Focus() : SendKeys.Send("{BACKSPACE}")
Or you can use this, which only removes the last char. unlike the SendKeys code.
With TextBox1
If Not .Text = "" Then .Text = .Text.Substring(0, .TextLength - 1)
End With
what about 2 textbox?
See if this helps about recognizing which TextBox is selected.
Public Class Form1
Private mySelectedCoolTextBox As TextBox '// used to determine which TextBox has Focus.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
mySelectedCoolTextBox.Focus() : SendKeys.Send("{BACKSPACE}") '// send the BackSpace key to your selected TextBox.
End Sub
Private Sub TextBox1_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) _
Handles TextBox1.GotFocus, TextBox2.GotFocus
mySelectedCoolTextBox = CType(sender, TextBox) '// set your selected TextBox.
End Sub
End Class
Thanks Codeorder. between i solve using aother coding you want to find out how i do it?
Not really interested, but others might find it useful. Do post your solution.
If textbox_GotFocus = 1 Then
With textbox
If Not .Text = "" Then
.Text = .Text.Substring(0, .TextLength - 1)
End If
End With
ElseIf textbox_GotFocus = 2 Then
With textbox2
If Not .Text = "" Then
.Text = .Text.Substring(0, .TextLength - 1)
End If
End With
End If
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.