سلام ، این کد رو امتحان کنید ، اگه جاییش نیاز به توضیح بود بگید
void gridviewMain_CellValidating(object sender, DataGridViewCellValidatingEventArgs e)
{
if (e.ColumnIndex == gridviewMain.Columns["ستون تاریخ"].Index)
{
string pattern =
"^\\d{4}/\\d{2}\\d{2}\\Z";
System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex(pattern);
System.Text.RegularExpressions.Match match = regex.Match(e.FormattedValue.ToString());
if (match.Success == false)
{
Msg.Show("تاریخ وارد شده صحیح نمیباشد");
e.Cancel = true;
}
}