Vikas Ahlawat

Vikas Ahlawat

  • NA
  • 564
  • 817.8k

How apply loop?

Oct 13 2009 1:34 AM
i have 10 labels on my form.
named label1,label2...........................label10
i want to fill the text in that , simply we do label1.Text="abc";
but i want to fill it through loop , because i have some condition

for (int i = 1; i <= 10; i++)
            {
                if (ds.Tables["Papers"].Rows[0][i].ToString()!= null)
                {
                    // here i want the label names accroding to the value of i , ex :- if i=1 then here label1.text="abc";
                      and when i=2 then label2.text="abc";

                     how can i do this
                }
            }

Answers (6)