0

I would like to convert Control objects wich are in my array to progress bar Objects if possible. I know that the reverse conversion can be done explicitly without a problem but this one seems tricky. If impossible then please suggest something else instead. TNX

2
Contributors
2
Replies
7
Views
3 Years
Discussion Span
Last Post by castajiz_2
Featured Replies
  • 1

    You'll have to explain more what you want. Progress Bar object that are referenced as Control objects can be converted with an explicit cast. If they aren't Progress Bar objects, they can't. Read More

1

You'll have to explain more what you want. Progress Bar object that are referenced as Control objects can be converted with an explicit cast. If they aren't Progress Bar objects, they can't.

0

Tnx Momerath for pointing things out. I tried again and it worked
this is the code:

 public void AccessPb()
     {
            foreach (Control gb in this.Controls)
            {
                if (gb.HasChildren)
                {
                    foreach (Control pb in gb.Controls)
                    {
                        if (pb is ProgressBar)
                        {
                            list.Add((ProgressBar)pb);
                        }
                    }
                }
            }
       }

Edited by castajiz_2: none

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.