2
Answers

chnging the font style of a cell in a datagridview

Ask a question
tekk

tekk

15y
13.7k
1


Hi for a value in a cell of a dgv I want to change the font style to bold when I click on a particular cell. For that I have written the following code under the dgv's cell click event but it is giving error

 private void dgvItemsDetails_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            DataGridViewRow row = dgvItemsDetails.CurrentRow;
            int index = row.Index;
            dgvItemsDetails.Rows[index].DefaultCellStyle.Font = Font.Bold;  // error here           
        }

Thanks

Answers (2)