I have a backspace key button.
Then I have two text boxes.
Well, it is working but when the letters in a certain text box are all cleared up then i keep on clicking the button I get this errror.
This is the code:
desiredTextbox.Text = desiredTextbox.Text.Substring(0, desiredTextbox.Text.Length - 1)
Then it has this error:
ArgumentOutofRange was unhandled

How am I supposed to do with that?
Thank you for any responses!

Edited by Khyxz

3 Years
Discussion Span
Last Post by Khyxz

Use Try Catch method


    'Your Backspace code

Catch ex as Exception

    MsgBox("No Value")
    'I use MsgBox to notify that there's no value.
    'Feel free to use other methods you see fit

End Try

Thank you for the quick response jared.geli.
I've already figured it out!
This is what I've done!
I just want to share it with others who has the same problem.

Here the code:

1. Private Sub Button38_Click(ByVal sender As System.Object, ByVal e As    System.EventArgs) Handles Button38.Click
2. If desiredTextbox.Text.Length <> 0 Then
3. desiredTextbox.Text = desiredTextbox.Text.Substring(0, desiredTextbox.Text.Length - 1)
4. End If
5. End Sub
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.