Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

formatted user control

Posted on 1998-08-10
3
Medium Priority
?
162 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 400 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

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…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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

824 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