Gustav Brock
Gustav at cactus.dk
Wed Jan 26 06:32:43 CST 2011
Hi Shamil As you describe it, it is exactly what I would do and expect. I have no explanation for why step 2 should set the DataGridView on hold ... /gustav >>> shamil at smsconsulting.spb.ru 26-01-2011 12:50 >>> Hi Gustav -- <<< Couldn't you try - when you open the form - to fill the DataGridView with one or few dummy records and then - when data is loaded - to switch to the real source? >>> Yes, this is what I'm doing: - 1) when a tab with datagridview is activated a user sees a message: "Loading grid's data rows..."; - 2) background(Worker) thread is started, which fills (via dataAdapter) a dataset which is not yet bound to the datagridview; - 3) when thread finished asynchnously it binds datagridview to the filled dataset using boundDataSource; Note: all the time while loading happens DataGridView is invisible and it only set to visible + ResumeLayout(false) + PerformLayout() when the data gets bound. Form becomes non-responsive for a while both on step 2 and step 3. I'm not that surprised about (3) but why loading large dataset in background worker thread should block form for a while - that's unclear here... <<< However, if this function is used only rarely and the retrieval only lasts for some seconds, I think I would just pop a message box: Please wait ... >>> Yes, that what happens now - but I wanted to make it more smooth in the future if possible... Thank you. -- Shamil -----Original Message----- From: dba-vb-bounces at databaseadvisors.com [mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: 26 ?????? 2011 ?. 13:03 To: dba-vb at databaseadvisors.com Subject: Re: [dba-VB] Non-blocking loading of a DataGridview using source MSAccess table with 120, 000+ rows.... Hi Shamil If "several seconds" is the time it takes to read the data from the Access database, it has to happen. And you do so in the background in a separate thread when you open the form and expect the form to be "live" while that happens. However, the form is dimmed or non-responsive until data has been loaded. Couldn't you try - when you open the form - to fill the DataGridView with one or few dummy records and then - when data is loaded - to switch to the real source? However, if this function is used only rarely and the retrieval only lasts for some seconds, I think I would just pop a message box: Please wait ... /gustav >>> shamil at smsconsulting.spb.ru 25-01-2011 17:33 >>> Hi All -- I have a .NET WinForm app with a DataGridView bound to an ADO.NET dataset getting data from MS Access/JET backend table. And I'd like to have my WinForm beeing *non-blocked* while loading that DataGridView with 120,000+ rows from an MS Access backend table. I do fire DataGridView data loading via TimerControl Tick event then run it via BackgroundWorker, I do use SuspendLayout etc. still as far as I see WinForm gets blocked for several seconds: - first when dataset's rows are retrieved, - second when DataGridView gets bound to retrieved dataset. Do you know about/have you seen somewhere any tricks how to make such a large data set loading non-blocking WinForm? It's not a big issue after all - I just wanted to make it working even more smoothly than it does work now - somehow like MS Access datasheets when they load data asynchronously... Of course using 120,000+ rows for a DataGridView is a questionable solution but that's a customer requirement: that much records they get in an year (then they archive/clear backend table and start from scratch) - and filtering that 120,000+ rows when they are loading happens almost instantly - so the only issue is initial loading/refreshing - the latter doesn't happen often... Thank you. -- Shamil