I have a problem with my data grid view, after i add a row the program freeze, this is my code:
private void ActivityLogAddRow(bool status, string desc, AVType avt)
{
DataGridViewRow row = new DataGridViewRow();
DataGridViewCell imageCell = new DataGridViewImageCell();
if (status == true)
imageCell.Value = Properties.Resources.success;
else
imageCell.Value = Properties.Resources.failure;
DataGridViewCell timeCell = new DataGridViewTextBoxCell();
timeCell.Value = DateTime.Now;
DataGridViewCell typeCell = new DataGridViewTextBoxCell();
typeCell.Value = avt.ToString();
DataGridViewCell descCell = new DataGridViewTextBoxCell();
descCell.Value = desc;
row.Cells.Add(imageCell);
row.Cells.Add(timeCell);
row.Cells.Add(typeCell);
row.Cells.Add(descCell);
dataGridView1.Rows.Add(row);
}
I can see the row added to the data grid view and than its(the program) stops, any body have a clue ?
p.s its takes a little bit too long to add the row(like couple of sec')
Update:
I get exception about two threads accessing the Datagridview, how can i fix it ? mutex ?