Results 1 to 4 of 4
  1. #1
    New Lounger
    Join Date
    Jun 2004
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Textbox (Office XP)

    I have created a form with some command buttons to input numbers into a textbox1. I also have a clear button if the user makes a mistake. But I now need a button to allow the user to back up one character if they make a mistake instead of clearing the whole textbox1. I am trying to complete the task using just the mouse. Thanks

  2. #2
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Textbox (Office XP)

    If this is a user form, then you could put something like the following into the click event routine for a command button:

    Private Sub CommandButton1_Click()
    If Len(TextBox1.Value) > 0 Then TextBox1.Value = Left(TextBox1.Value, Len(TextBox1.Value) - 1)
    TextBox1.SetFocus
    End Sub
    Legare Coleman

  3. #3
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: Textbox (Office XP)

    If the c9ommandbutton is named commandbutton1 and the textbox is textbox1 (change as appropriate), you could use something like:

    <pre>Private Sub CommandButton1_Click()
    Dim s As String
    s = TextBox1.Value
    If s <> "" Then _
    TextBox1.Value = Left(s, Len(s) - 1)
    End Sub</pre>


  4. #4
    New Lounger
    Join Date
    Jun 2004
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Textbox (Office XP)

    Thanks for the help, it works perfect. Thanks again

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •