Hi Gil Yoktan,
The cause of the low performance is that too many columns are added in the DataGridView. From my experience, we can set the header text of the columns in the constructor of the form which would be faster than in the Load event handler. If we need to pass the header text to the form, we can create a new constructor which takes a string list as the parameter. This is a code snippet:
public Form1(List<string> colHeaderText)
{
InitializeComponent();
const int count = 360;
//Add the columns.
for (int i = 0; i < count; i++)
{
this.dataGridView1.Columns.Add(i.ToString(),i.ToString());
}
//Set the header text of the columns.
for (int i = 0; i < count; i++)
{
this.dataGridView1.Columns[i].HeaderText = colHeaderText[i];
}
}
Let me know if this does not help.
Aland Li
Please mark the replies as answers if they help and unmark if they don't. This can be beneficial to other community members reading the thread.