Skip to content

How can i use a masked textbox column in a datagridview for date

lee Juu

Asked Apr 27, 2006, 3:00 AM EDT1 answer
Share
LinkedInX
How can i use a masked textbox column in a datagridview for date
================================================================

I am working with Visual studio 2005 and c# 2005.

I have a datagridview which contains a date column and will accept value as 26-04-2006.Initially value will be 00-00-0000.When we press any key it will check value which we entered is number or not.if it is number then it will check for other conditions like

1 the day is greater 32 or not?
2 the month is greater than 12 or not?
3 the year is greater than 2006 or not?..like that.

we have to find in keypress event and cancel each character if it fails.

when we do backspace each value must changed to zeros..

I used masked textbox in datgridview for this but i am facing so many issues for that..

When we editing it will not work properly..the values are getting overlapped with the grid contents and all..i created the masked textbox dynamically in editcontrolshowing event..

if anybody did the same pls help me it is very urgent..

If you have any other solution that are also welcome

thanks in advance,


lee ju

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • +1
    There is a similar example present in the SDK documentation whioch briefly describe the creation of Masked TextBox Column in a DataGridView. I had download it few months back but unfortunalty I forget the correct keywords through which you can find that code in MSDN. But I have the code of that tutorial in which MSDN teaches how to make Masked Text Box Column. I don't know how to upload that code in this forum so please email me at this address [email protected] if you still want the code, I will email you the code example.

    Adnan Hasan
    +1