[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Entering data into text box

Posted on 2002-06-22
7
Medium Priority
?
203 Views
Last Modified: 2010-05-02
I am trying to get visual basic to delete a previous entry shown in a text box when user starts to enter a new entry.  All efforts result new entry adding on to or inserting new text into a prior entry.  MSN says it can be done but fails to tell us how. And many programs do this. It should be unnecessary for user to have to backspace out a previous entry every time a revised entry is entered.

It should be easy???  Why not???
0
Comment
Question by:forrestx
[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
7 Comments
 
LVL 2

Accepted Solution

by:
egsemsem earned 400 total points
ID: 7101020
Add this code in GotFocus event of the text box. As soon as the textbox got focus, all the text will be selected, and so it will be deleted once the user starts typing.

Private Sub Text1_GotFocus()
    Text1.SelStart = 0
    Text1.SelLength = Len(Text1.Text)
End Sub

I hope I have helped,

Osama
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 7101025
Place this code into the GotFocus event

Private Sub Text2_GotFocus()
    With Text2
        .SelStart = 0
        .SelLength = Len(.Text)
    End With
End Sub
0
 
LVL 1

Expert Comment

by:Mahdi Mansour
ID: 7110075
or place this code in gotFocus:

text2.text=""
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 70

Expert Comment

by:Éric Moreau
ID: 7128885
Any progress?
0
 
LVL 2

Expert Comment

by:egsemsem
ID: 7133856
hi forrestx, where are u?
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 7348059
This question appears to be abandoned. A question regarding it will be left in the CleanUp
area; if you have any comment about the question, please leave it here.

Unless there is objection or further activity, one of the moderators will be asked to accept the comment
of <egsemsem >.

DO NOT ACCEPT THIS COMMENT AS AN ANSWER.
0
 
LVL 5

Expert Comment

by:Netminder
ID: 7373290
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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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…
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…
Suggested Courses

650 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