日期:2014-05-20  浏览次数:20693 次

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);
            }
        }