Hi
try this example..
// Establish the Relationship "RelCustOrd" between Customers
---< Orders
System.Data.DataRelation relCustOrd;
System.Data.DataColumn colMaster1;
System.Data.DataColumn colDetail1;
colMaster1 = ds.Tables["Customers"].Columns["CustomerID"];
colDetail1 = ds.Tables["Orders"].Columns["CustomerID"];
relCustOrd = new System.Data.DataRelation("
RelCustOrd",colMaster1,colDetail1);
ds.Relations.Add(relCustOrd);
The Combobox doesn't have a DataMember property - instead it has a
DisplayMember and ValueMember property:
-
The DisplayMember of a Combobox gets or sets
a string that specifies the property of the data source whose contents you
want to display.
|
-
The ValueMember property determines which value gets moved into the SelectedValue of the Combo
Box. In the example, whenever the user selects a Customer by "Customers.CompanyName", the SelectedValue is the "Customers.CustomerID". Whenever the
SelectedValue changes, the data-binding moves the new value into the Customer
object.
|
// Setup the combobox view
and display-, value member
cbCust.DataSource = dsView;
cbCust.DisplayMember = "Customers.CompanyName";
cbCust.ValueMember = "Customers.CustomerID";
Hope this helps
SAN