T
Tim Johnson
I wanted a "progress form" to monitor uploading a big batch of records via a
web service a few records at a time. In between batches I update a label
count field and issue Application.DoEvents(). In pseudo code it looks like
this:
lbl.Text = "0";
batchsize = 0;
for i=0 to bignum
{
getnext rec, add to table in dataset
batchsize++;
if batchsize = 50
{
cnt = webservice(dataset); //synchronous call
lbl.Text = cnt.ToString();
Application.DoEvents();
batchsize=0;
}
}
But about half to 3/4 of the time, the lbl.Text assignment seems to just
hang. In the debugger it goes in with F10, but it don't come out. In
runtime, debug or release, the loop never ends, presumably also stuck at the
same place.
I'm not doing this in form_Load, but in a routine triggered by the user
pushing a button, so all loading is settled down.
If I remove DoEvents, it works great every time. But of course I can't see
any progress.
How can I both see progress and make progress?
--
Tim Johnson
High Point Software, Inc.
www.high-point.com
(503) 312-8625
web service a few records at a time. In between batches I update a label
count field and issue Application.DoEvents(). In pseudo code it looks like
this:
lbl.Text = "0";
batchsize = 0;
for i=0 to bignum
{
getnext rec, add to table in dataset
batchsize++;
if batchsize = 50
{
cnt = webservice(dataset); //synchronous call
lbl.Text = cnt.ToString();
Application.DoEvents();
batchsize=0;
}
}
But about half to 3/4 of the time, the lbl.Text assignment seems to just
hang. In the debugger it goes in with F10, but it don't come out. In
runtime, debug or release, the loop never ends, presumably also stuck at the
same place.
I'm not doing this in form_Load, but in a routine triggered by the user
pushing a button, so all loading is settled down.
If I remove DoEvents, it works great every time. But of course I can't see
any progress.
How can I both see progress and make progress?
--
Tim Johnson
High Point Software, Inc.
www.high-point.com
(503) 312-8625