I had made a datagridview inside my windows form application in C#. However when the value I recorded exceed 9 or 10. The scrollbars is not appearing and the application freeze and not responding. I tested the application in Windows 10 is working fine but in Windows XP have this issue. I search alot same issue question but the solution couldn't solve my problem. The code I use for datagridview:
dataGridView1.Invoke((MethodInvoker)(() => dataGridView1.Visible = true));
table.Rows.Add(dataGridView1.Rows.Count + 1, thicness.Text, "FAIL");
dataGridView1.Invoke((MethodInvoker)(() => dataGridView1.Refresh()));
if (dataGridView1.Rows.Count > 1)
{
if (dataGridView1.ScrollBars == ScrollBars.Both)
{
dataGridView1.Invoke((MethodInvoker)(() => dataGridView1.ScrollBars = ScrollBars.Vertical));
}
else if (dataGridView1.ScrollBars == ScrollBars.Vertical)
{
dataGridView1.Invoke((MethodInvoker)(() => dataGridView1.ScrollBars = ScrollBars.Both));
}
dataGridView1.Invoke((MethodInvoker)(() => dataGridView1.Refresh()));
}
dataGridView1.Invoke((MethodInvoker)(() => dataGridView1.Refresh()));
Because I calling the function inside another function. Therefore, I need to use Invoke but this seem effecting the datagridview. Then I try to change the properties of the scrollbars whenever new value come in. It only works on Windows 10 but not the Windows XP. I show the application freeze picture in drive because I am not allow to post picture in the question due to I am new in stackoverflow. https://drive.google.com/file/d/1HXCjLwDKDMhUvbOqlp0WIel-w9JrBmyy/view?usp=sharing
Anyone know how to solve this problem?