Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Erase the text

Posted on 2009-04-02
5
Medium Priority
?
136 Views
Last Modified: 2012-05-06
How to erase the text as shown example below?
Private Sub Command1_Click()
Text1.Text = Left(Text1, Len(Text1) - 1)
End Sub

now in text1.text has number of  "12345"
Can i erase the 4 or any of them using commandButton by pointing the cursor after the number i wanted to erase?

Thanks a lot!
0
Comment
Question by:Whing Dela Cruz
  • 2
  • 2
5 Comments
 
LVL 7

Expert Comment

by:cmrobertson
ID: 24051057
text.seltext in the textbox will give you the position in the textbox that is currently selected you can then create a string pulling that one out if you need details to accomplish let me know, sorry i was going to put in last q but it was closed
0
 

Author Comment

by:Whing Dela Cruz
ID: 24051102
Can you give me example?
0
 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 1200 total points
ID: 24051108
Give the TextBox Focus and then send a BackSpace.  Whatever was before the cursor will be erased...
Private Sub Command1_Click()
    Text1.SetFocus
    SendKeys "{BACKSPACE}"
End Sub

Open in new window

0
 
LVL 7

Assisted Solution

by:cmrobertson
cmrobertson earned 800 total points
ID: 24051135
a = Me.Text
b = Mid(Me.Text.Text, 1, Me.Text.SelStart) & Mid(Me.Text.Text, Me.Text.SelStart + 2)
this assumes cursor in front of letter to eliminate
0
 

Author Closing Comment

by:Whing Dela Cruz
ID: 31565841
Thanks Both of you,
The code is working...
Thanks a lot! More Power!
0

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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

876 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question