Backspace Button in VB.NET

We often click a backspace button in which this button is a keyboard key that display cursor one position backwards and deletes the character at that position, and shifts back the text after that position by one position. In this tutorial we will create this button. So now, let's start this tutorial! 1. Let's start with creating a Windows Form Application for this tutorial by following the following steps in Microsoft Visual Studio: Go to File, click New Project, and choose Windows Application. 2. Next, add only one Button named Button1 and labeled it as "Backspace", and one TextBox named TextBox1 for us to have an inputted string. You must design your interface like this: design 3. Now put this code for your code module. This code is for Button1_Click as our Backspace Button:
  1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  2.         If TextBox1.Text < " " Then
  3.             TextBox1.Text = Mid(TextBox1.Text, 1, Len(TextBox1.Text) - 1 + 1)
  4.         Else
  5.             TextBox1.Text = Mid(TextBox1.Text, 1, Len(TextBox1.Text) - 1)
  6.         End If
  7.     End Sub

Explanation:

If textbox1 has a text value on it then TextBox1.Text = Mid(TextBox1.Text, 1, Len(TextBox1.Text) - 1 + 1). The Mid Function here returns a string containing a specified number of characters from a string in the textbox1 up to length of the textbox1 minus 1 + 1 of its length. Len Function here Returns an integer containing either the number of characters in a string or the nominal number of bytes required to store a variable. Otherwise if textbox1 is equal to nothing or null, then textbox1 will have its cursor be vanished.

Output:

Type any word from the textbox. output Then click the backspace button. output Download the source code below and try it! :) For more inquiries and need programmer for your thesis systems in any kind of programming languages, just contact my number below and hire me. Best Regards,

Engr. Lyndon R. Bermoy
IT Instructor/System Developer/Android Developer
Mobile: 09079373999
Telephone: 826-9296
E-mail:[email protected]

Visit and like my page on Facebook at: Bermz ISware Solutions

Subscribe at my YouTube Channel at: SerBermz

Comments

the code working good for colc i made Dim a as intger for 0 the code a= a+ "." TextBox1.Text = a for the back space you code + a= "" will be working good

this command so helpful, thank you for sharing this, i hope u have a nice day

Add new comment