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

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.

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 2 Years Ago by castajiz_2: none

This question has already been answered. Start a new discussion instead.