Get Dinamyc a Control and convert to label or text

1 posts, 0 answers
  1. RM04550
    RM04550 avatar
    2 posts
    Member since:
    Mar 2014

    Posted 20 Mar 2014 Link to this post


    How I change dinamyc a control that get by this.Controls.FindAll() in Label or Text by variables for example I have
    or get all controls and set the tooltips to all, I have something like this: 

    IEnumerable<Control> controlesEntrada = this.Controls.FindAll();
    foreach (Control control in controlesEntrada)
    {
       c = control.GetType();
       myelement = c.Name; //Get the string "Label" in this variable

        //How I do this:
         Label milabel = (Label)myelement;
        // with the variable
         myelement milabel (myelement)myelement
    }
    this dont permit because string to control cant... how I can be?




       
    c9.Tooltip = "Este es tu label";
Back to Top