Click here to Skip to main content
15,897,891 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Greetings to all,

I'm beginner programmer developing a small WinForms application in Visual Studio 2015 using C# .Net and need a date input mask (not format) for the numbers entered in the first column of a DataGridView. How do I go about doing that? I'd really appreciate some sample code. Thank you very much for your all your time and help.

Best regards,

What I have tried:

I haven't tried any code because I don't even know how to begin!
Posted
Updated 17-Sep-18 13:31pm

1 solution

As a "beginner" (or even if not), it's sometimes easier just to have separate columns for year, month and day when doing data entry (like: is it yyyymmdd; ddmmyyyy; yyyy-mm-dd; etc. etc.) The "user" won't mind if you don't make them use "more" keystrokes.

The data grid does not support the "masked edit control" (which is what you want).

And a "date" is not a date until it is "valid"; so forget about "formatting", and "validate" the "date columns" when ready to "save"; then combine to make a "date" for storing. "Split" it again, later, when editing again.
 
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