for (int i = 0; i < 5; i++)
{
dataGridView1.Columns.Add("col", "col");
Thread.Sleep(1000);
}
When I run this code all the columns show up at one time after 5s not one by one every 1 second. Please help me, I don’t want to use timers.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This is extremly extremly nasty code, and you Should use timers.
However, if you insist on doing it this way, try to throw in a
Application.DoEvents()(shudder) after theThread.Sleep(100);line.By the way, why do you not want to use timers? They are very easy to set up and will make this code much cleaner than it will end up this way.