DataGridView SuspendLayout BeginInit

G

Gwl

I have a DataGridView and following code:

private void button1_Click(object sender, EventArgs e)
{
dataGridView1.ColumnCount = 365;
}

When I click on the button it is extremely slow (some seconds) to
create the table. I tried to change code to:

private void button1_Click(object sender, EventArgs e)
{
dataGridView1.SuspendLayout();
dataGridView1.ColumnCount = 365;
dataGridView1.ResumeLayout(false);
}

but nothing change. Also tried using

((System.ComponentModel.ISupportInitialize)
(this.dataGridView1)).BeginInit();

without success. What should I do?
Thank you, g.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top