string was not recognized as a valid dateTime.

Apr 18 2021 6:01 AM
am using dateTimePicker in dataGridView and SQL database
  1. private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)  
  2. {  
  3.     try  
  4.     {  
  5.         string ColName = dataGridView1.Columns[e.ColumnIndex].Name;  
  6.         if (ColName == "ColEdit")  
  7.         {  
  8.             formExecutiveInfoEntry frm = new frmExecutiveInfoEntry(this);  
  9.             form.dtDateJoin.Text = dataGridView1.Columns[1].DefaultCellStyle.Format = "dd-MM-yyyy";  
  10.         }  
  11.     }  
  12. }

Answers (13)