Hi, The datagridview filling is very fast but the database access is the bottleneck in the system. And even if it's a few seconds, during this time the user cannot go through the datagridview and the database access is done very often (each 30 seconds). So is a very annoying behavior. It would be very nice if you can drop me some "hello world" about delegates also. By the way, is there a good book to learn about "common solutions" to situations like this with threading?
Thanks very much for answering Nacho On Feb 6, 4:48 pm, InfRes <[email protected]> wrote: > 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
