473,406 Members | 2,439 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

How can I update datagrid while table is being filled??

VM
Initially, I had created my Windows application so that my datagrid's source
would be updated once the method that filled the table was finished:

private void btn_run_Click(object sender, System.EventArgs e)
{
...
myTable = Match.fillTable();
datagrid.datasource = myTable;
}
public DataTable fillTable ()
{
...
for (int i=0; i<10000;i++)
{
//Creates row and adds it to my datatable myTable
}
return myTable;
}

The user wouldn't see anything in the grid for about 2-3 seconds but that
was an acceptable amount of time. But now, instead of a 10,000 row loop,
it'll be a loop of 400,000+ rows (about 1.5 minutes that user will be
staring at blank grid) . We already know that it displays the 400,000 rows
in the grid but I'd like to be able to update the grid every 10,000 rows so
the user can scroll through the grid while the table's filling up in the
background.

How would I have to modify the code?

Any help is appreciated.

Thanks.
Nov 16 '05 #1
1 1317
VM,

I don't think that you can do this, and it does raise the question of
what you are trying to do that requires 400K+ rows of information to be
shown at one time?

What I would do in this situation is create the table that has no rows
in it and then bind to that. Once you do that, you should then fill the
table in another thread. That thread would then call Invoke on the data
grid, passing a delegate that will call a function that makes the call to
add the row to the table. This way, you can get a little more interaction
when displaying rows of the grid. However, it might take longer overall,
because you are going to be making these calls across threads to do so.

"VM" <vo******@yahoo.com> wrote in message
news:eU**************@tk2msftngp13.phx.gbl...
Initially, I had created my Windows application so that my datagrid's source would be updated once the method that filled the table was finished:

private void btn_run_Click(object sender, System.EventArgs e)
{
...
myTable = Match.fillTable();
datagrid.datasource = myTable;
}
public DataTable fillTable ()
{
...
for (int i=0; i<10000;i++)
{
//Creates row and adds it to my datatable myTable
}
return myTable;
}

The user wouldn't see anything in the grid for about 2-3 seconds but that
was an acceptable amount of time. But now, instead of a 10,000 row loop,
it'll be a loop of 400,000+ rows (about 1.5 minutes that user will be
staring at blank grid) . We already know that it displays the 400,000 rows in the grid but I'd like to be able to update the grid every 10,000 rows so the user can scroll through the grid while the table's filling up in the
background.

How would I have to modify the code?

Any help is appreciated.

Thanks.

Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Ashish Shridharan | last post by:
Hi All I have been trying to add a control to the header cell of a datagrid on my ASP.NET page. These controls are defined in the HTML as ASP.NET web controls. They are being added into the...
2
by: VM | last post by:
When I display data to a Windows datagrid I usually fill the underlying table (in another class) and then, once it contains all the data, I attach it to the grid. But there are some processes that...
5
by: Steve B. | last post by:
A particular column in my Access DB table, and the associated datagrid, cannot have duplicate string entries. I've selected "Yes (no duplicates)" for the Indexed Field Property of this column in...
5
by: Hennie | last post by:
When trying to update a record in an editable datagrid I ran into a few problems. My update procedure is just not working. Can someone please have a look at my code and see what am I doing wrong....
25
by: Neo Geshel | last post by:
This works: <form> <asp:TextBox id="name" /> <%= name.ClientID %> </form> But this DOES NOT work: <form>
13
by: Lyners | last post by:
I have a web page writen in ASP.NET that contains some javascript so that when a user presses a button, or edits a certain field in a datagrid, another cell in the datagrid is filled with a value....
9
by: Michael | last post by:
Hi, I have a large table. Normally, the user will need to see only the data from the past two years, but sometimes, they will need to go back further. I have a form with a datagrid, a...
4
by: William LaMartin | last post by:
In the past, I have filled a datagrid with data from an Access database table using a data adapter and dataset, where I used the OleDbCommandBuilder to have the program create the insert, delete...
1
by: Sharon | last post by:
Hello All, Is it possible to update Sql Table through DataGrid. I have a DataGrid which is being populated through a stored procedure, all i wanted to do is to update one field...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.