天行健,君子以自强不息;地势坤,君子以厚德载物;
执着,追求…… 行动,坚持……

目的:在一panal上面有三个combobox,我想查找一个名称为:number 看其是否为这三个combobox中的一个,如是为其中一个,则将一系列一字符值给他;
查找函数:
 private System.Windows.Forms.Control findControl(System.Windows.Forms.Control control, string controlName)
        {           
            Control c1;           
            foreach (Control c in control.Controls)
            {
                if (c.Name == controlName)
                {                                   
                    //*********************************************************************************************************************
                        问题的出现地;
      在这里需要将:
      c.item.add("111");
                        c.item.add("222");    现在时:c它没有item属性,仅有text属性
                        c.item.add("333");                      
                    //*********************************************************************************************************************
                    return c;
                }
                else if (control.Controls.Count > 0)
                {
                    c1 = findControl(c, controlName);
                    if (c1 != null)
                    {
                        return c1;
                    }
                }
            }
            return null;
        }    
急盼回信;

posted on 2007-07-10 16:36  gesone  阅读(1029)  评论(4编辑  收藏  举报