Click here to Skip to main content
15,890,282 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
String[] names = new String[] { "A" , "B" , "C" , "D" , "E" };
textBox1.DataBindings.Add( "Text" , names , null ); 


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.
Posted
Comments
Henry Minute 16-Nov-10 10:17am    
In response to your comment:

Not on my system it didn't. I got 'D' in my control. I used a Label, not a TextBox, but that should make no difference.

1 solution

I just tried
C#
textBox1.DataBindings.Add( "Text" , names[3] , null );


which worked for me.
 
Share this answer
 
Comments
tuolesi 16-Nov-10 10:14am    
but it bind to the first elemnt of the array.i m trying to bind it to the forth elemnt .

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900