Sometimes using MaskedTextBox control in a Windows Form does not display correctly the date when you bind it with a DateTime data type. It removes the leading ZEROES of the date when you run the program. Like this example below:
The solution is before databinding the MaskedTextBox control to the DataSet at runtime, you should apply the necessary format string you want your date to be displayed. Check out the code below for the solution (txtDateHired as the name of the MaskedTextBox Control):
Binding dateHired = new Binding("Text", ds, "Employees.DateHired");
dateHired.FormattingEnabled = true;
dateHired.FormatString = "MM/dd/yyyy";
txtDateHired.DataBindings.Add(dateHired);
Using this code, the dates will display properly on the form when using a MaskedTextBox control as part of your User Interface.
hi VP
ReplyDeletei need database for your code at PSC for project named "Production Program (Complete Application in VB.Net & C# Code)". if you pl. give me the download link or send it to my email at prj.navin@gmail.com
Thanks
Hello VPDJ. Greetings from Venezuela.
ReplyDeleteI saw your production system and it seemed interesting, but I need databases for learning and testing purposes. I will appreciate if you send me your mail to my oaguiar@gmail.com.
I wish you all the luck, and thanks
Thanks a lot for the good articles. I also saw your production system and it is very interesting, can you please provide the databases for learning and testing purposes. My email is: emulondo@nkumbauniversity.ac.ug
ReplyDeleteI wish you all the luck, and thanks
Hi VP,
ReplyDeleteKindly share with me you Production Program Database.My email abdazz25@gmail.com
Thanks and regards
Abdalla
Hi VP,
ReplyDeleteI saw your production system program on psc, it seems interesting to me, would you please send the database to my email, ruslan.graha@yahoo.com, thx in advance
Sincerely,
Ruslan
Hi VP,
ReplyDeleteI saw your production program on PSC. May have the database for testing.
thank you