Solved

Entering data into text box

Posted on 2002-06-22
7
201 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 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

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

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…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

724 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