0
我已经动态的FlowLayoutPanel中从SQL表这样如何将数据从动态添加文本框读取到FlowLayoutPanel?
string query = "SELECT* FROM tblA";
using (SqlConnection conn = new SqlConnection("Data Source=.;Initial Catalog=DummyData;Integrated Security=True"))
{
conn.Open();
using (SqlCommand cmd = new SqlCommand(query, conn))
{
SqlDataReader reader = cmd.ExecuteReader();
while (reader.Read())
{
Label objLbl = new Label();
TextBox objText = new TextBox();
objLbl.Text = reader["A_Name"].ToString();
objText.Name = "txt"+reader["ID"].ToString();
pnlFlow.Controls.Add(objLbl);
pnlFlow.Controls.Add(objText);
}
}
}
它的正常工作添加文本框。现在我面临的问题是用户在这些文本框中输入一些数据。我如何获得这些数据以进一步处理?