我现在要问的是如何动态加载界面。问题是这样的界面根据从数据库中读取数据的不同加载不同的控件形成界面,比如当我从3个有关联的数据库表中读取指定条件的数据时,如果三个表中都有满足要求的相应记录,那么在加载界面时要用三组控件来显示数据,如果只有两个表中的数据满足要求那么加载两组控件来显示数据。当然也有可能时要读取10个表。大家有什么好的建议!!!!!!!
请指教!!!!!!!!!!!!

解决方案 »

  1.   

    就和普通做的一样啊,只不过原来Bill帮你写的代码现在自己写:)
      

  2.   

    Button x = new Button();
    // Add properties to the form
    x.Name = "btn" + m_ControlCount.ToString();
    x.Text = "btn" + m_ControlCount.ToString();
    x.Location = new Point(this.m_Location.X + 250, this.m_Location.Y);
    m_Location.Y += x.Height + 5;
    // Add the two event handlers  
    x.Click += new System.EventHandler(myButtonHandler_Click);
    x.MouseHover += new System.EventHandler(myButtonHandler_MouseHover);
    // Add the control to the collection of controls
    Controls.Add(x);
      

  3.   

    TextBox txt = new TextBox();
    this.Controls.Add(txt);...