This should be an easy one, but I'm not sure the best way to do it.

I've got a form, and when I click a button it starts looping through an
array. With each iteration of the array I want it to change the status of a
label.

I realise that it must complete the execution of the code-behind page before
it can update the labels, so how do I do it?

TIA, Bruce

Re: EASY ONE? looping and updating labels with each iteration by Bernie

Bernie
Sat Nov 22 15:07:11 CST 2003

Hi Bruce,

Are we talking winforms or ASP .Net?

Bernie Yaeger
"Bruce Whitehouse" <bruce@REMOVE_THISallstarfun.co.uk> wrote in message
news:%23YtDGhEsDHA.3224@tk2msftngp13.phx.gbl...
> This should be an easy one, but I'm not sure the best way to do it.
>
> I've got a form, and when I click a button it starts looping through an
> array. With each iteration of the array I want it to change the status of
a
> label.
>
> I realise that it must complete the execution of the code-behind page
before
> it can update the labels, so how do I do it?
>
> TIA, Bruce
>
>



Re: EASY ONE? looping and updating labels with each iteration by Miha

Miha
Sat Nov 22 15:38:21 CST 2003

Hi,

I think he is talking about asp.net (note the code-behind page combination
of words :) )

Here is the code to find all controls and set their values (using
reflection):
FieldInfo[] fis = typeof(WebForm1).GetFields(BindingFlags.NonPublic |
BindingFlags.Instance);

foreach (FieldInfo fi in fis)

if (fi.FieldType == typeof(Label))

{

Label l = (Label)fi.GetValue(this);

l.Text = "Tubo";

}

Maybe there is an easier way (you could create an array of labels in Init()
method or something).


--
Miha Markic - RightHand .NET consulting & development
miha at rthand com



"Bernie Yaeger" <berniey@cherwellinc.com> wrote in message
news:OwDjYyTsDHA.3536@tk2msftngp13.phx.gbl...
> Hi Bruce,
>
> Are we talking winforms or ASP .Net?
>
> Bernie Yaeger
> "Bruce Whitehouse" <bruce@REMOVE_THISallstarfun.co.uk> wrote in message
> news:%23YtDGhEsDHA.3224@tk2msftngp13.phx.gbl...
> > This should be an easy one, but I'm not sure the best way to do it.
> >
> > I've got a form, and when I click a button it starts looping through an
> > array. With each iteration of the array I want it to change the status
of
> a
> > label.
> >
> > I realise that it must complete the execution of the code-behind page
> before
> > it can update the labels, so how do I do it?
> >
> > TIA, Bruce
> >
> >
>
>



Re: EASY ONE? looping and updating labels with each iteration by Bruce

Bruce
Sun Nov 23 03:12:25 CST 2003

Sorry guys

I realise I posted this under ADO.NET rather than ASP.NET


actually, I know the status of all my labels and controls. this isn't
what I was trying to do.

What I was wanting to do was loop through some code in my VB (code behind
page). The loop is actually going through 15 or so web services (which take
up to 2 minutes each), so on each iteration of the loop (for each
webservice) I wanted to let the user know what the status was of each web
service call.

I'm about to re-write the page using an array and a datagrid. I'll be
letting the page complete, checking for what is to happen next, execute the
method, update label, let page reload, etc, etc.

Bruce

"Bruce Whitehouse" <bruce@REMOVE_THISallstarfun.co.uk> wrote in message
news:%23YtDGhEsDHA.3224@tk2msftngp13.phx.gbl...
> This should be an easy one, but I'm not sure the best way to do it.
>
> I've got a form, and when I click a button it starts looping through an
> array. With each iteration of the array I want it to change the status of
a
> label.
>
> I realise that it must complete the execution of the code-behind page
before
> it can update the labels, so how do I do it?
>
> TIA, Bruce
>
>