Avatar of comsult
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).Cells("IsSelected").Value = True Then
                    DataGridView1.Rows(id).Cells("BINPrice").Value = txtApplyBINPrice.Text
                    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.
.NET Programming

Avatar of undefined
Last Comment

8/22/2022 - Mon

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question

Thank you very much, that is at least five times quicker.
Your help has saved me hundreds of hours of internet surfing.