panel动态增加的控件怎么 取值问题?
//成型时间控件for (int i1 = 0; i1 <shuliang; i1++)
{
DateTimePicker chengxingshijian = new DateTimePicker();
chengxingshijian.Name = "Chengxingshijian" + i1.ToString();
chengxingshijian.CustomFormat = "YYYY-MM-DD";
chengxingshijian.Value = DateTime.Now;
chengxingshijian.CustomFormat = "YYYY-MM-DD";
chengxingshijian.Left = left;
chengxingshijian.Top = i1 * (top * 3 + chengxingshijian.Height*3) + top;
chengxingshijian.Width = 130;
panel1.Controls.Add(chengxingshijian);
}
//龄期
for (int i3 = 0; i3 < shuliang; i3++)
{
TextBox lingqi = new TextBox();
lingqi.Name = "lingqi" + i3.ToString();
lingqi.Text = lingqicb.Text.Trim();
lingqi.ReadOnly = true;
lingqi.Width = 60;
lingqi.TextAlign = HorizontalAlignment.Center;
lingqi.Left = left + 140;
lingqi.Top = i3 * (top * 3 + lingqi.Height * 3) +top;
panel1.Controls.Add(lingqi);
}
//抗压时间控件
for (int i1 = 0; i1 < shuliang; i1++)
{
DateTimePicker kangyashijian = new DateTimePicker();
kangyashijian.Name = "kangyashijian" + i1.ToString();
DateTime dt = chengxingshijian.Value.Add(TimeSpan.Parse(lingqi.Text.Trim()));
kangyashijian.Value = dt;
kangyashijian.CustomFormat = "YYYY-MM-DD";
kangyashijian.Left = left + 210;
kangyashijian.Top = i1 * (top * 3 + kangyashijian.Height * 3) + top;
kangyashijian.Width = 130;
panel1.Controls.Add(kangyashijian);
}
我要怎么取到上面两个动态增加控件的文本值?