hodaya

hodaya

  • NA
  • 1
  • 1.3k

Redraw C#

Dec 3 2013 3:33 AM
Hi there,

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?