I am explaining my problem elaborately. I have a dataGridView
in Windows main form. I have a timer which is starting when button1 is clicked. and it stops when button2 is clicked.
Now in the meantime I am calculating something and putting it in the dataGridView
. This is a dynamic calculation. In this calculation I am using a Thread. (I am absolutely new in Threads) . I have used Thread.Sleep(100)
to calculate data. Now I am using a Thread.Sleep in a loop where I am calculating data of consecutive things. I want the respective order of the calculation to remain. After each iteration of the loop I am using dataGridView.Rows.AddRange(DataGridViewRow)
to add new row with new data calculated.
But I am not getting the data in the dataGridView in the order and also it's not coming properly. It's getting blanked out sometime and coming randomly.
P.S - I am clearing the data each time when the timer interval is over.