当前位置: 代码迷 >> .NET Framework >> winform用户控件有关问题、求帮助!
  详细解决方案

winform用户控件有关问题、求帮助!

热度:67   发布时间:2016-05-02 00:28:10.0
winform用户控件问题、急求帮助!!!
我事先做好了一个用户控件,然后新建了一个winform界面,现在要根据从数据库里查出来的数据的个数,来决定要在界面上动态添加多少个用户控件,并且根据从数据库里查出来的数据的不同,用户界面里显示的内容也不同。这个怎么做。

求正解


急求正解


可以加分。

------解决方案--------------------
C# code
        private void button1_Click(object sender, EventArgs e)        {            int count = 5;   //查处来的个数            for (int i = 0; i < count; i++)            {                TextBox tbox = new TextBox();   //用户控件                tbox.Text = "查出来的数据";                tbox.Location = new Point(30, i * tbox.Height);                this.Controls.Add(tbox);            }        }
  相关解决方案