Solved

Erase the text

Posted on 2009-04-02
5
131 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…
Suggested Courses
Course of the Month8 days, 5 hours left to enroll

617 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