'Nother, larger binding problem


P

Peter

OK, so in addition to the problem I mentioned before (c.f. "Data Binding to
Textbox"), I realized that my comboboxes are not really bound to the
internal data set. They are just set to manually change to reflect whatever
the selected row's foreign keys are.

So the question is, how can I bind the SelectedItem of a combobox, which is
filled with DataRowView objects from its bound table, to a field in
whichever row of a dataset happens to be selected in a Listbox, also full of
bound DataRowView objects?

That's a lotta words. Does it make sense? I basically want the same
combobox, populated with all possible parent table values, to be able to
edit a foreign key field in whatever row of a table (from a strongly typed
dataset) happens to be selected in a listview.

And I don't want to use a datagrid control because there is no
DataColumnComboBox control in VS 2002.
 
Ad

Advertisements

C

Cor Ligthert [MVP]

Peter,

Databinding is very simple, let say you want to bind a textbox to a combobox
both there text area

You start with the textbox.

Textbox1.Databinding.Add("Text",Combobox1,"Text")

Be aware that DataBinding is a collection from Textbox1 and has no direct
relation with combobox1. (you can not see in combobox1 that it is bound)

Cor
 
P

Peter

That type of data binding is indeed simple.

But I don't have any idea where to start with a more complex question such
as what I'm trying to do... i.e. have the row to which my controls are bound
change based on the user's row selection in a listbox. Can you give me an
equally simple line of code that will do that?
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top