Solved

Erase the text

Posted on 2009-04-02
5
128 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 85

Accepted Solution

by:
Mike Tomlinson earned 300 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 200 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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

790 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