We have a DataGridView and the following code:
private void button1_Click(object sender, EventArgs e)
{
{
dataGridView1.Rows.Add(15);
int k = dataGridView1.Rows.Count - 1;
for (int i = 0; i < k; i++)
dataGridView1.Rows[i].Cells[0].Value = i;
}We want that the changes will occur after cliking on the button.
We tried to change code to:
private void button1_Click(object sender, EventArgs e)
{
{
dataGridView1.SuspendLayout();
dataGridView1.Rows.Add(15);
int k = dataGridView1.Rows.Count - 1;
for (int i = 0; i < k; i++)
dataGridView1.Rows[i].Cells[0].Value = i;
dataGridView1.ResumeLayout(false);
}but adding this rows didn't help.... :(
Someone know why?
Replies
Know the answer? Post it — somebody with the same question will find it here.