Hi Nacho, Is it the returning the 200000 records that is slow or the filling/displaying the datagridview?
a faster approach would be paging the records However if you do want to use the threading approach you will need to use delegates. create a function (which will run on the primary thread) which adds a line to the datagridview create a delegate to this function, pass the delegate in as a parameter to the function running in the worker thread. then for each record, (in your datareader/dataset) build into a datagridviewrow and call your delegate passing the datagridviewrow If you need a code sample let me know... Steve On Feb 5, 12:00 pm, Nacho108 <[email protected]> wrote: > Hi everyone! > > I'm trying to start using threads in this application I'm making and > I'm having some problems. > The task is simple: I want to read a database with 200000 records > that's situated in another PC, so it takes some seconds. Then I want > to show them in a datagridview control. > The thing is that I'm trying to fill a dataset which I define in the > main thread and I cannot access it within the "worker" thread, and If > I define it within the worker thread I cannot send it to the main > thread. > > Can somebody explain to me how people solve this problem? > > Thanks!! > Nacho
