Ali,
>I assigned :
> BindingSource : Customer
> BindingSourceDisplayMember : CompanyName
> BindingSourceValueMember : CustomerID
>
>I filled the below event:
>
>private void cboCustomers_SelectedIndexChanged(object sender, System.EventArgs e)
> {
> int nIndex = this.cboCustomers.SelectedIndex;
> this.txtCustomerID.Text = this.oCustomer.GetCurrentDataSet().Tables[0].Rows[nIndex][0].ToString();
> }
>
>System is working. The question is:
>
>Is there easer way to get selected CustomerId?
Since the CustomerID is already stored in the combo box, it's easier to get the selected value from the combo box's SelectedValue property:
private void cboCustomers_SelectedIndexChanged(object sender, System.EventArgs e)
{
this.txtCustomerID.Text = this.cboCustomers.SelectedValue;
}
Regards,
Kevin McNeish
Eight-Time .NET MVP
VFP and iOS Author, Speaker & Trainer
Oak Leaf Enterprises, Inc.
Chief Architect, MM Framework
http://www.oakleafsd.com