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
Solved

Entering data into text box

Posted on 2002-06-22
7
198 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
7 Comments
 
LVL 2

Accepted Solution

by:
egsemsem earned 100 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
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.

 
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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

Suggested Solutions

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.
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

840 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