Solved

formatted user control

Posted on 1998-08-10
3
143 Views
Last Modified: 2010-04-30
I have written a usercontrol based on a textbox that will format and validate the data entered to the required set property, ie. Y2K date, long, decimal to two places, etc. It works well but has a serious flaw. The control uses the show,lostfocus and resize events to format and validate its data. However if I want to place a calculated value into the control from an action somewhere else none of the above events get called and I have raw data in the control. Is there a way to kick the usercontrol into realising that its data has been changed?.  
0
Comment
Question by:tinybyte
3 Comments
 
LVL 1

Expert Comment

by:brunchey
ID: 1468436
Use the change event of the textbox or whatever control you are using.
0
 

Author Comment

by:tinybyte
ID: 1468437
I wish it were that simple. The CHANGE event monitors each keystroke and if you entering a date it will give an error immediately because you can't have a one letter date or if it is a numeric to two decimal places will immediately give 1.00 etc . What I need is a method for the control to recognise that a calculated value from another source is NOT coming from the keyboard and then format and validate it. With keyboard entry the ENTER key, lostfocus signify that data entry is complete.
0
 
LVL 2

Accepted Solution

by:
percosolator earned 200 total points
ID: 1468438
That sounds like an interesting control.

create a new property, or use the text property to kick-off your validation routines.

I would choose the former, create a new property, and on the property let validate the data, that way you have an alternative method of loading the control, but with no validation (Text).  Call it "ValidText" or something.




0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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

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.
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…
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…

860 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