Faster way to update datagridview?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Askelassen
    New Member
    • Nov 2009
    • 6

    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:

    Code:
            // Event triggered when the user wants to add an aditional command row to his datagridview.
            private void AddCommandButton_Click(object sender, EventArgs e)
            {
                CommandClass MyDataLine = new CommandClass();       // This is the objects that fills the datagrid
                commandLineList.Add(MyDataLine);                    // Adds the new object to the data source of the datagrid
                dataGridView1.DataBindings.Clear();                 // Clears databindings
                dataGridView1.DataSource = null;                    // Clears data source
                dataGridView1.DataSource = commandLineList;         // Sets the correct data source
                ComboBoxValueSelect();                              // Updates the values of a combobox contained in the gridview
            }
Working...