I have a datagridview connected to a sql database and everything works fine. I want to show the field "Date" (datetime on the database) formatted just as "dd/MM/yyyy" on a MessageBox.
I have it like this:
MessageBox.Show(dataGridView1.CurrentRow.Cells[4].Value.ToString());
and it shows:
What can I add or edit in the code to remove the hours?
Fixed it:
string message = (dataGridView1.CurrentRow.Cells[4].Value.ToString());
MessageBox.Show(message.Remove(10).ToString());
What this does is remove the last characters of the string, in this case the characters being the time