Click here to Skip to main content
15,916,835 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello members of CodeProject,
I have a project, a database with employee information (name, town, birthday, HireDate, etc). I have add custom TextBox (on fly), and on that TextBox a code:
TexBox1.text = DateDiff("d", HireDateDateTimePicker.value, Now)
which is calculating how many days worker is working in company from HireDate, and Now.
I have put code on event TextBox1_TextChanged. But, this means that I need to move cursor in TextBox1 to apply changes.
I have also try with MouseMove. It works, but if I would have a huge database, then application will all the time reading script on MouseMove, and by that will slow down entire program.
Need someone to give a tip, example, etc...
Thank you in advance for help to anyone.
Posted

HireDateDateTimePicker_ValueChanged is a good place to put your line.

When you update your DTP with database value or manually, you'll get the updated days correctly in this case.
 
Share this answer
 
Comments
E.F. Nijboer 18-Jan-11 10:08am    
We had the same thought :-)
Prerak Patel 18-Jan-11 10:11am    
In this case most of us will have the same thought. ;)
Espen Harlinn 18-Jan-11 10:44am    
5+ Good answer
fjdiewornncalwe 18-Jan-11 16:55pm    
+5. Count me in on having the same thought as well.
How about putting that code in the changed event of the HireDateDateTimePicker. That control is actually updated and accordingly does TextBox1 needs to be.

Good luck!
 
Share this answer
 
Comments
Espen Harlinn 18-Jan-11 10:44am    
5+ Good answer
Thanks for replies, and help.

I have took a tip from Patel. Not the same solution, but similar. I have add a clock on form, which is of course changing text. And on that label I have put a code on Label_textchanged. :-D
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900