DataBind数组到文本框 [英] DataBind array to textbox

查看:87
本文介绍了DataBind数组到文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

String[] names = new String[] { "A" , "B" , "C" , "D" , "E" };
textBox1.DataBindings.Add( "Text" , names , null ); 



如何将文本绑定到数组名称为[3]的元素4?

任何人都可以向我展示为上述情况提供2向装订的方法吗?

我尝试编辑textBox1的databind属性,但对我来说似乎很奇怪(需要从对象或数据库等中选择数据源),如何使用它,以便可以将其快速绑定到如上所示的数组. >
谢谢您的帮助.



How do i bind the text to element 4 of the array,names[3]?

Can anyone show me the way to provide 2-way binding for above situation?

I try to edit the databind property of textBox1 but it seem odd to me(need to select data source from object or database and etc),how to use that so i can quickly bind it to the array as shown at above.

Thx for your help.

推荐答案

我刚刚尝试了
I just tried
textBox1.DataBindings.Add( "Text" , names[3] , null );



对我有用.



which worked for me.


这篇关于DataBind数组到文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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