comsult
asked on
VIsual Studio 2005 (VB Winform) Datagrid FOR Iteration Very Slow
In a VS2005, VB Windows app we populate a datagridview from a SQLCE DB.
The grid has a check box ("IsSelected") which allows the user to select individual rows or they can select all if required.
Once the selection has been made, they use a combobox outwith the grid and a button to alter the value in one column (BINPrice). As there can be as many as 5000 rows in the grid, this is taking several minutes using the following FOR :
Dim id As Integer
For id = 0 To DataGridView1.Rows.Count - 1
If DataGridView1.Rows(id).Cel ls("IsSele cted").Val ue = True Then
DataGridView1.Rows(id).Cel ls("BINPri ce").Value = txtApplyBINPrice.Text
Else
MsgBox("To be added later")
End If
Next id
As we fill the grid from the DB in around four seconds, surely there must be a quicker way of doing this ? Is it possible to select the whole column and then apply the value from the combobox ?
Any help will be greatly appreciated, thank you.
The grid has a check box ("IsSelected") which allows the user to select individual rows or they can select all if required.
Once the selection has been made, they use a combobox outwith the grid and a button to alter the value in one column (BINPrice). As there can be as many as 5000 rows in the grid, this is taking several minutes using the following FOR :
Dim id As Integer
For id = 0 To DataGridView1.Rows.Count - 1
If DataGridView1.Rows(id).Cel
DataGridView1.Rows(id).Cel
Else
MsgBox("To be added later")
End If
Next id
As we fill the grid from the DB in around four seconds, surely there must be a quicker way of doing this ? Is it possible to select the whole column and then apply the value from the combobox ?
Any help will be greatly appreciated, thank you.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER