473,385 Members | 1,531 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,385 software developers and data experts.

Faster way to update datagridview?

Hey

I am currently developing an GUI that contains a datagridview. The datasource for the gridview is an ArrayList. I have had som problems adding new rows to the datagrid while the GUI was running. I finaly got it to add a new row when I clicked a button, but when the number of datarows exeeds about 10 rows it starts to be slow to add rows. This is because it has to refresh all the data for every new row added. Do you guys know a way to add a row to the datagrid without having to refresh all the data. My code for adding a new row is the following:

Expand|Select|Wrap|Line Numbers
  1.  
  2.         // Event triggered when the user wants to add an aditional command row to his datagridview.
  3.         private void AddCommandButton_Click(object sender, EventArgs e)
  4.         {
  5.             CommandClass MyDataLine = new CommandClass();       // This is the objects that fills the datagrid
  6.             commandLineList.Add(MyDataLine);                    // Adds the new object to the data source of the datagrid
  7.             dataGridView1.DataBindings.Clear();                 // Clears databindings
  8.             dataGridView1.DataSource = null;                    // Clears data source
  9.             dataGridView1.DataSource = commandLineList;         // Sets the correct data source
  10.             ComboBoxValueSelect();                              // Updates the values of a combobox contained in the gridview
  11.         }
  12.  
  13.  
Nov 15 '10 #1
0 1632

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: David | last post by:
I have a realtime stock quote system developed where I am updating a typed dataset with realtime quotes. I want my DataGridView control to show green forecolor when a price moves up and red...
8
bplacker
by: bplacker | last post by:
I have a datagridview which is filled with data from a table in a database. In the grid, the user clicks a row to edit that specific record. An edit screen is brought up, which has a text box for...
2
by: janero | last post by:
I´m new in .net and i am working with an access database. I have set up my program in many ways, with just code or with the grid datasource set to the database. I can not add rows or update either...
4
by: Arne Beruldsen | last post by:
I just can't seem to get the datagridview to update. I'm using 2005 vb.net Here's my code for loading the grid (works fine) and my attempt at updating via a save button... Private SxAdapter...
11
by: dave18 | last post by:
Hello all! I found a solution to my original question, but there's still so much I don't understand about it, I thought I'd give this forum a try. At the very least, maybe it will help someone...
13
by: Neil | last post by:
I'm running an update query in SQL 7 from QA, and it runs forever. Has been running for 20 minutes so far! The query is quite simple: update a single field in a table, based on a join with another...
1
by: shajeela | last post by:
1.I create a datagridview control 2.connected using a oledb adapter 3.problem is if i run the program the old value is displayed 4.for viewing the old value i have to close the current window,and...
7
by: newbtemple | last post by:
Hey all, trying to update a cell in a dgv when I have a new value for it. I'm not sure how to go about it. I've looked online but, like the books I have, there isn't much information on dgvs or...
1
by: ocean | last post by:
i have this code: string conString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\Users\\Khai\\Documents\\MyNum… string queryM = "SELECT * FROM magnum WHERE todayDate = #" + pickedDate.Date...
2
by: xinnie | last post by:
Hi guys, I have a form with datagridview, using access as my db. I have created a textbox with a search button, so what I want is; after entering the keyword for my search, i want my datagridview...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...

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.