Solved

formatted user control

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
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…
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…

863 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now