Back button

mak2gd

Member
Joined
Jul 9, 2005
Messages
15
Location
Hartford, USA
Programming Experience
5-10
Back button(Resolved)

Hi,
I am trying to create a back button to delete one digit from the right of text box value. Can you please suggest a .net solution?

Thanks in advance.
 
Last edited:
Really strange idea ... if user is able to type why then he/she cannot use delete or backspace buttons as well? However, this is an idea that just need to start solution ... of course it needs to be considered more preciselly in order to find right solution (maybe you can declare two variables, one would be always previous value of the textbox and another one current value ... then just pass previous value ... )

This is the rough example that will give you an idea however.

VB.NET:
[size=2][color=#0000ff]Private[/color][/size][size=2] [/size][size=2][color=#0000ff]Sub[/color][/size][size=2] Button1_Click([/size][size=2][color=#0000ff]ByVal[/color][/size][size=2] sender [/size][size=2][color=#0000ff]As[/color][/size][size=2] System.Object, [/size][size=2][color=#0000ff]ByVal[/color][/size][size=2] e [/size][size=2][color=#0000ff]As[/color][/size][size=2] System.EventArgs) [/size][size=2][color=#0000ff]Handles[/color][/size][size=2] Button1.Click
[/size][size=2][color=#0000ff]Dim[/color][/size][size=2] txt [/size][size=2][color=#0000ff]As[/color][/size][size=2] [/size][size=2][color=#0000ff]String[/color][/size][size=2] = [/size][size=2][color=#0000ff]Me[/color][/size][size=2].TextBox1.Text

[/size][size=2][color=#0000ff]Me[/color][/size][size=2].TextBox1.Text = txt.Substring(0, [/size][size=2][color=#0000ff]Me[/color][/size][size=2].TextBox1.Text.Length - 1)

[/size][size=2][color=#0000ff]End[/color][/size][size=2] [/size][size=2][color=#0000ff]Sub[/color][/size]
[size=2][color=#0000ff][color=#000000]
[/color][/color][/size]


Cheers ;)
 
Thank you for your help. But the txt.substring does not seem to work. Also, what is the equivalent of setfocus property? It was available in vb6 but it does not seem to work in .net.

Thanks again.
 
Hey, Mid and Mid$ are overdated vb6 functions in vb.net. Substring method is Mid func equivalent and it works just fine ... btw, can you explain what didn't work for you?

Cheers ;)


take a look at the attached project ... just click the Button1 and it will remove the last character ... but as i told you, this is not adequate solution for your intention :)
 

Attachments

  • StringbackKey.zip
    20.9 KB · Views: 34
Last edited:
Hi Kulrom

I found out what I missed on your method. I had forgotten this line:



Dim txt AsString = Me.TextBox1.Text

As soon as I added this, it worked just as good.

Thanks for your help.
 
Back
Top