Reputation: 1299
If I have a grid with a list of items (IList<x>
) and a textbox on the form, is there a way to bind the data so that as I click a row that the textbox.text gets updated, without doing it explicitly?
In other words, I want to be able to use Binding() or some other way, and not do
OnSelectionChanged
textbox.text = x.somefield
as I will have several controls that need updating, and I have to believe there is a better way of doing it.
Upvotes: 0
Views: 242
Reputation: 3658
If your grid is databound to your items
grid.DataSource=items;
You can use this:
textbox.DataBindings.Add("Text", items, "somefield");
Upvotes: 1