Hello, Can you please tell me I have a visual c # program
On the form there is a datagridview which displays information and a button for updating this information from the database.
If I put the function that updates the grid into a separate thread in the BackgroundWorker_DoWork event (object sender, DoWorkEventArgs e) and when I click the button, I call BackgroundWorker_DoWork.RunWorkerAsync () then the grid is wonderfully updated and everything goes well.
But if I start BackgroundWorker_DoWork.RunWorkerAsync () from a timer that works periodically, then the function that starts the update of the grid works, but starts to swear that I refer to the datagridview from the stream in which it does not exist.
And at the same time, if you run the update grid function directly from the timer, without using BackgroundWorker, then everything goes well too.
Why when launching another stream from the timer, the elements of the application form are not visible in it, and if you start from the button, everything can be seen perfectly?