tekk

tekk

  • NA
  • 101
  • 0

chnging the font style of a cell in a datagridview

Aug 25 2009 3:28 AM


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)