Solved

formatted user control

Posted on 1998-08-10
3
138 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
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…
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…

786 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