Programming issue while applying text to the third party control.

Posted by srivatsa on Stack Overflow See other posts from Stack Overflow or by srivatsa
Published on 2010-04-28T08:50:06Z Indexed on 2010/04/28 8:53 UTC
Read the original article Hit count: 285

Filed under:
|

Hello

I have used some third party controls in my windows application.

There is a snippet which is being used in our code which re-initializes all the .text property of all the controls on the form.

Everything works fine except for a control. This control is similar to the Windows Panel except for it has a dropdown appearance. This control has .Caption property instead of .Text property associated to it.

This causes the problem whenever i use such codes

foreach (Control oControl in this.Controls)
{
    if (oControl is DropDownPanel)
    {
       {
          oControl.Text = rm_ResourceManager.GetString(oControl.Name + ".Text");
       }
    }
}

The text is not set here for the DropDownPanel control in the above method. Since .Text is not available for DropDownPanel control.

I cannot do the following either ..

((DropDownPanel)oControl).Caption = rm_ResourceManager.GetString(oControl.Name + ".Text");

Cos it shall throw exception if i try to cast oControl with that of DropDownPanel

Any ideas how can i overcome such a condition.

Regards

© Stack Overflow or respective owner

Related posts about .NET

Related posts about oops