Reputation: 667
Hello got the error in following code..
The method RefeshDataGridView() is static.I run it in a separate thread to refresh the grid and get the latest data from DB table. I made dataGridView1 static because the method RefeshDataGridView() uses it. Can anyone describe why this error is occurred and how to solve it??
Update: If I make dataGridView1 non static then the error is gone.. But then I couldn't use it in the static method..
Upvotes: 0
Views: 376
Reputation: 18031
I suppose dataGridView1 is null
. You have to instanciate it or pass an instance of it as a parameter to RefreshDataGridView().
Upvotes: 2