• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2730
  • Last Modified:

Virtual touch screen keyboard,I need help with backspace vb.net

Hello experts,  I created a simple virtual keyboard,  that sends the button text to a textbox.  For example if the A button is pressed, "A" will show up in the textfield.  And if Enter is pressed I send vbcrlf.  I am having trouble with the backspace button,  how do I clear one character in the textfield when backspace is checked?

  Sub filltext(ByVal charval As String)
        Me.txtmessage.Text += charval
    End Sub


    Private Sub btnz_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnz.Click
        filltext(btnz.Text) 'sends a z to the txtmessage
    End Sub

    Private Sub bntenter_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bntenter.Click
        filltext(vbCrLf) 'sends a line break
    End Sub

 Private Sub bntback_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bntback.Click
'What do I put here to clear out one character in the textfield
    End Sub
0
tentavarious
Asked:
tentavarious
1 Solution
 
AlexFMCommented:
Me.txtmessage.Text = Me.txtmessage.Text.Substring(0, Me.txtmessage.Text.Length - 1)
0
 
jrschererCEOCommented:
Hi tentavarious

Try this
Private Sub bntback_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bntback.Click
      If Me.txtmessage.Text.Lenght > 0 Then
            Me.txtmessage.Text = me.txtmessage.Text.Substring(0, Me.txtmessage.Text.Length - 1)
      End If
End Sub

Jack.net
0
 
tentavariousAuthor Commented:
Thanks, thats what I was looking for.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now