Information générale
Catégorie:
The Mere Mortals .NET Framework
Titre:
Again a mmCombobox question
Hi,
On the "Order System CSharp" example CustomerOrders form, List tab page,
I wanted to select CustomerID from a combobox, instead of entering manually.
I have added Customer business object. It has a method as:
public DataSet GetAllCustidAndCompanyName()
{
return (this.GetDataSet("SELECT CustomerID, CompanyName FROM Customers"));
}
I put a mmCombobox control to form.
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?
Thanks,
Ali Ihsan
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement