?
Solved

Overtyping in a text box

Posted on 2000-03-15
6
Medium Priority
?
249 Views
Last Modified: 2008-03-04
How do I get VB to allow me to overtype data already contained within a text box, that has already hit its maximum amount of characters? I have a text box with a string of 50 chrs in it, and naturally, when I go to type anything in this box, VB won't let me because the box is full. I want to allow the user to overtype what is already in there - how do I do it? (please help)
0
Comment
Question by:TGB
  • 2
  • 2
  • 2
6 Comments
 
LVL 7

Expert Comment

by:Vbmaster
ID: 2619274
The easiest solution would be to simple add..

  Text1.SelLength = 1

... to the KeyPress event of the textbox.
0
 
LVL 3

Accepted Solution

by:
paulstamp earned 80 total points
ID: 2619308
vbMaster's comment is the answer if you want to overtype a single character... however if you want your typing to replace the entire string use this :

Private Sub Text1_Activate()

    Text1.SelStart = 0
    Text1.SelLength = len(text1.text)

End Sub

When the user clicks on your textbox the entire text will be highlighted and any new text replaces the whole lot.
0
 

Author Comment

by:TGB
ID: 2619327
Cheers. But I can't seem to get the 'Activate' event to come up. What am I doing wrong? (Using VB6.0)
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 7

Expert Comment

by:Vbmaster
ID: 2619359
Perhaps this is because there is no Activate event? ;)  The GotFocus() event is probably what paulstamp meant.
0
 

Author Comment

by:TGB
ID: 2619403
Cheers for the help. ;)
0
 
LVL 3

Expert Comment

by:paulstamp
ID: 2620302
Sorry... mind going... yes - form_gotfocus()
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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…
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

749 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