Update progress bar to reflect database update?

  • Thread starter Thread starter Pierre
  • Start date Start date
P

Pierre

Hi, I was wondering if anyone ever done a progress bar that reflects a
database update. I have an update query with SQL server that takes
about 5 minutes. I can't figure out a way to show the progress of the
update in a progress bar since I have no idea how much time it will
take. Anyone ever done this??
 
Hi Pierre,

I do exactly what you're trying to do. I use the datatablerow_changed
event. First, create your pbar; then add this code before calling
performstep:
AddHandler dt.RowChanged, New DataRowChangeEventHandler(AddressOf
DataTableRow_Changed)

The code of the event is as follows:
Public Sub DataTableRow_Changed(ByVal Sender As Object, ByVal e As
System.Data.DataRowChangeEventArgs)

' The DataRow has changed. update pbar2

glf_icount += 1

If glf_icount > (pbar2.Maximum / 100) Then

glf_icount = 0

pbar2.PerformStep()

Application.DoEvents()

End If

glf_totalcount += 1

prglabel.Text = glf_totalcount

End Sub

HTH,

Bernie Yaeger
 
Back
Top