Progressbar

N

nobody

Hi

I'm currently developing a Windows application. At the start of the
application I load several tables into datatables in a dataset. I also use
a progressbar to show the user how much percent of the total is already
loaded. But I do this in a dirty way: I increment the progressbar with the
same number after each table, but not all tables contain the same amount of
data. I solved this with starting an other thread to increment the
progressbar.

So what I'm asking is:
How do I link my progressbar to the loading of the tables. Keeping in mind
that not every datatable contains the same amount of data. The progressbar
should be complete if all tables are loaded. If the first table has 50% of
the total data, after loading the first table the progressbar should be at
50%.

Nice to have would also be, if I was able to increment the progressbar
while loading the tables, not only after the table is loaded. In that way
the progressbar fills up more fluently.

It would be great if anyone could help me out with this.

Greetings and happy holidays
 
B

Brian Henry

first what you do is get a count of how much data is in the table... save
that as the max value of the table count... then assign a event to your
data table to handle row changes

me.progBar = table size (at least this so you don't get an overflow)
AddHandler dt_TempTable.RowChanged, New DataRowChangeEventHandler(AddressOf
UpdateProgress)

that will give you a status of each row that was added or changed and fire
the even at the procedure UpdateProgress

Private Sub UpdateProgress(ByVal sender As Object, ByVal e As
System.Data.DataRowChangeEventArgs)

if e.Action = DataRowAction.Add

Me.progBar.value +=1

Application.DoEvents()

End Sub

increments progress bar as a new row is added to the data table it's
referencing
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top