cómo cambiar el texto en datagridview texto en la condición.
Estoy usando un datagridview y quiero mostrar los medios de formato condicional cuando llego a una celdaM
entonces quiero mostrarMarried
. Intento esto pero no tengo éxito.
Aquí está mi código:
private void masterDataGridView_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
{
try
{
for (int i = 0; i <= masterDataGridView.Rows.Count - 1; i++)
{
String Value = masterDataGridView.Rows[i].Cells[17].Value.ToString();
if (Value == "M")
{
e.Value = "Male";
}
}
}
catch (Exception ex)
{
}
}