Search code examples
vb.netbackspace

After clicking backspace button text starts from the beginning of a textbox


The button works but after it is pressed the text needs to start when it was left off and not in the beginning.

 '' Button to remove 1 number
Private Sub btnCE_Click(sender As Object, e As EventArgs) Handles btnCE.Click
    If pinbox.Text.Count > 0 Then '' Works if count is bigger then 0
        pinbox.Text = pinbox.Text.Remove(pinbox.Text.Count - 1) '' Remove 1 number
    End If

Here is a visual representation of the problem

image

And yes i am aware that CE is the wrong term used and i will change it :(


Solution

  • I think changing this line in each number:

    pinbox.Text= btn7.Text 
    

    To:

    pinbox.Text= pinbox.Text + btn7.Text 
    

    Should put the new text at the end of the pinbox.