I'm working on datagridview in c# windows forms application and I'm loading the data from the database,Now i want to edit the cell value and save the value to the database, Here i have date and time in my database.
when i click the row header in datagridview the data are transfer to the text boxes and also in datetime picker
data are copy in textbox correctly but it gives error message when copy in datetimepicker.
code i done.
private void dgvpbx_RowHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
{
txtname.Text = dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString();
cmbidentifier.Text = dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString();
txtplace.Text = dataGridView1.Rows[e.RowIndex].Cells[3].Value.ToString();
txtcity.Text = dataGridView1.Rows[e.RowIndex].Cells[4].Value.ToString();
dtpdate.Value = Convert.ToDateTime(dataGridView1.Rows[e.RowIndex].Cells[5].Value.ToString());
dtptime.Value = Convert.ToDateTime(dataGridView1.Rows[e.RowIndex].Cells[6].Value.ToString());
}
Error message is