您的位置:首页 > 博客中心 > 数据库 >

c#中动态创建textbox并且从数据库中获取表中数据添加到textbox中

时间:2022-03-14 03:12

gxlsystem.com,布布扣gxlsystem.com,布布扣

 1         private void FormLugOther_Load(object sender, EventArgs e)
 2         {
 3             foreach (string str in FormLug.FieldListLug1)
 4             {
 5                 try
 6                 {
 7                     Label label = new Label();
 8                     label.Text = str;
 9                     this.tableLayoutPanel1.Controls.Add(label);
10                     TextBox textbox = new TextBox();
11                     textbox.Name = "tb" + str;
12                     textbox.Text = FormLug.tbValue.Rows[0][str].ToString();
13                     this.tableLayoutPanel1.Controls.Add(textbox);
14                 }
15                 catch
16                 {
17                     return;
18                 }
19             }
20         }
View Code

 

热门排行

今日推荐

热门手游