I am using DataGridView CellFormating to format specified cells.
The code I am trying:
private void dgwPart_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
{
if (this.arts.Type == ArtType.Pak)
{
if (dgwPart.Columns[e.ColumnIndex].Name == "Discount")
e.Value = "";
}
}
The problem is that it changes the value for all column, but I only want that it changes the value for specified row. How do I manage it?
You can use e.CurrentCell to find whether it is the row you want, something like:
* these should be within the cellformat, after you check the column. you may need check the syntax, I just typed this from my header.