I want tu put 0 before the day and month dates. How can we modify the following codes?
private void dataGridView1_CellFormatting(object sender, DataGridViewCellFormattingEventArgs formatting) { if (formatting.Value != null) { try { System.Text.StringBuilder dateString = new System.Text.StringBuilder(); DateTime theDate = DateTime.Parse(formatting.Value.ToString()); dateString.Append(theDate.Day); dateString.Append("/"); dateString.Append(theDate.Month); dateString.Append("/"); dateString.Append(theDate.Year.ToString()); formatting.Value = dateString.ToString(); formatting.FormattingApplied = true; } catch (FormatException) { // Set to false in case there are other handlers interested trying to // format this DataGridViewCellFormattingEventArgs instance. formatting.FormattingApplied = false; } } }