在.net windows app中动态添加控件列表 [英] dynamically adding list of controls in .net windows app
本文介绍了在.net windows app中动态添加控件列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
int count = 1;
string name =textBox+ count.ToString();
TextBox name = new TextBox() ;
但它没有工作........请帮助
解决方案
首先,你不能用它名称,但一次..在您的代码中,int count = 1;
string name =textBox+ count.ToString();
TextBox name = new TextBox();
name
使用两次...
并且,试试这个作为你的解决方案..
int count = 1;
string str =textBox+ count.ToString();
TextBox nameTxt = new TextBox();
nameTxt.Text = str;
aam developing a windows app, i want that on clicking a button textboxes will be created with names textBox1,textBox2,textBox3....i am able to create textboxes and add it form, but i want the names to be dynamic e.g
int count=1;
string name="textBox"+count.ToString();
TextBox name=new TextBox();
But its not working........please help
解决方案
First thing, you can''t use same name but once.. In your code,int count=1; string name="textBox"+count.ToString(); TextBox name=new TextBox();
name
is used twice...
and, try this as your solution..
int count=1; string str="textBox"+count.ToString(); TextBox nameTxt=new TextBox(); nameTxt.Text = str ;
这篇关于在.net windows app中动态添加控件列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文