如何读取dinamic创建Textbox的价值? [英] How read value dinamic created Textbox?

查看:61
本文介绍了如何读取dinamic创建Textbox的价值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好!我动态创建TextBox,例如:



  private   void  CreateLabels( int  lblID, string  lblName){

y_lbl = y_lbl + 38 ;
Label lbl = new Label();
lbl.Name = lbl _ + lblID;
lbl.Text = lblName;
lbl.AutoSize = true ;
lbl.Location = new Point( 63 ,y_lbl);
lbl.Size = new 大小( 33 13 );
CrtCurs.Controls.Add(lbl);

}





我希望得到TextBox的值为Name = lbl_1;

我怎么做?

解决方案

这应该这样做



http ://stackoverflow.com/questions/9066118/c-sharp-get-value-of-dynamically-created-control

Hello! I create dynamically TextBoxes such:

private void CreateLabels(int lblID, string lblName) {

           y_lbl = y_lbl + 38;
           Label lbl = new Label();
           lbl.Name = "lbl_" + lblID;
           lbl.Text = lblName;
           lbl.AutoSize = true;
           lbl.Location = new Point(63, y_lbl);
           lbl.Size = new Size(33, 13);
           CrtCurs.Controls.Add(lbl);

       }



After i wanna get value of TextBox with Name = lbl_1;
How i can do it?

解决方案

This should do it

http://stackoverflow.com/questions/9066118/c-sharp-get-value-of-dynamically-created-control


这篇关于如何读取dinamic创建Textbox的价值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆