VB.NET - Fill data in ListView as it happens

Possibly a difficult one to describe but I have a Windows Form that fills a dataset with contents from an Excel spreadsheet and then queries each service tag per row against Dell's online warranty service.
It all works fine thanks to another contributor on here but for one small niggle.
When the process is running it does not show any data until it finishes. You can see it's working as the progress bar fills up and the scroll bar keeps reducing in size to indicate data is being added to the ListView.
So how can I change this so that as soon as one line within the loop is complete it adds it to the ListView so I can see the data in real time?
Using con As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & txtFile.Text & ";Extended Properties=""Excel 12.0 Xml;HDR=YES"";")
                con.Open()
                Using cmd As New OleDbCommand
                    cmd.Connection = con
                    Dim ds As New OleDb.OleDbDataAdapter("Select * from [" & wksheet & "]", con)
                    'Dim dt As New DataTable
                    '
                    Using dt As New DataTable
                        ds.Fill(dt)
                        Dim rowcount As Integer
                        rowcount = dt.Rows.Count()
                        Dim sB As Long = rowcount
                        Dim cR As Long = 0
                        cR = cR + rowcount
                        'pb1.Value = (cR / sB) * 100
                        'dt.Load(cmd.ExecuteReader)
                        For Each dtr As DataRow In dt.Rows
                            '/ Get the value from the row here:
                            Dim counter As Integer
                            Dim proxy As New com.dell.xserv.AssetService()
                            Dim sGUID As New Guid("11111111-1111-1111-1111-111111111111")
                            Dim sOutput As com.dell.xserv.Asset() = proxy.GetAssetInformation(sGUID, "Dell Warranty Tool", dtr("serial_number"))
                            Dim eData As Object() = sOutput(0).Entitlements
                            For Each ed As com.dell.xserv.EntitlementData In eData
                                If ed.ToString() > "" Then
                                    Dim PC As String
                                    If Not IsDBNull(dtr("computer_name")) Then
                                        PC = dtr("computer_name")
                                    End If
                                    Dim user As String
                                    If Not IsDBNull(dtr("user_name")) Then
                                        user = dtr("user_name")
                                    Else
                                        user = "No user"
                                    End If
                                    Dim model As String
                                    If Not IsDBNull(dtr("computer_model")) Then
                                        model = dtr("computer_model")
                                    End If
                                    Dim EndDate As String
                                    EndDate = ed.EndDate.ToString()
                                    Dim endD = EndDate.Remove(10, 9)
                                    Dim refresh As Date = endD
                                    Dim currentdate As DateTime = DateTime.Now
                                    Dim expirydate As String

                                    If model.Contains("OptiPlex") Then
                                        expirydate = DateAdd(DateInterval.Year, 2, refresh)
                                    ElseIf model.Contains("Latitude") Then
                                        expirydate = DateAdd(DateInterval.Year, 1, refresh)
                                    ElseIf model.Contains("Precision") Then
                                        expirydate = DateAdd(DateInterval.Year, 1, refresh)
                                    End If
                                    Dim refreshdate As Date = expirydate
                                    Dim diff As Long = DateDiff(DateInterval.Day, currentdate, refreshdate)

                                    Dim lvi As New ListViewItem
                                    lvi = ListView1.Items.Add(PC)
                                    lvi.SubItems.Add(user)
                                    lvi.SubItems.Add(model)
                                    lvi.SubItems.Add(endD)
                                    If expirydate < currentdate Then
                                        lvi.SubItems.Add("Lifecycle Expired")
                                    End If
                                End If
                                counter += 1
                                pb1.Value = counter / rowcount * 100
                            Next

                            AddHandler Me.ListView1.ColumnClick, AddressOf ColumnClick
                        Next dtr
                    End Using
                End Using
            End Using

Open in new window

LVL 2
fruitloopyAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AndyAinscowFreelance programmer / ConsultantCommented:
Does this work (In VBA the Application. wouldn't be needed but I think you have to have it in VB.Net)
                                pb1.Value = counter / rowcount * 100
Application.DoEvents
                            Next

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
fruitloopyAuthor Commented:
I was hoping it would be something simple. Thanks Andy!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.