P
Paolo
Having problems with combo box Display Member and Value Member.
Using a typed dataset I have the following:
private void frmMain_Load(object sender, EventArgs e)
{
cmbxPayee.DisplayMember = dataSet.Payee.P_NameColumn.ToString();
cmbxPayee.ValueMember = dataSet.Payee.P_IdColumn.ToString();
cmbxPayee.DataSource = dataSet.Payee;
}
The combo box is being correctly populated with payee names.
Later I do:
private void cmbxPayee_DisplayMemberChanged(object sender, EventArgs
e)
{
string thePayeeId = cmbxPayee.ValueMember.ToString();
MessageBox.Show(thePayeeId);
}
What is showing in the messageBox is the name of the column (P_Id) not the
value of the column (e.g. "D").
Have I correctly initialised the variable in my frmMain_Load method, and if
so, why is the value of the column not being shown?
Thanks
Using a typed dataset I have the following:
private void frmMain_Load(object sender, EventArgs e)
{
cmbxPayee.DisplayMember = dataSet.Payee.P_NameColumn.ToString();
cmbxPayee.ValueMember = dataSet.Payee.P_IdColumn.ToString();
cmbxPayee.DataSource = dataSet.Payee;
}
The combo box is being correctly populated with payee names.
Later I do:
private void cmbxPayee_DisplayMemberChanged(object sender, EventArgs
e)
{
string thePayeeId = cmbxPayee.ValueMember.ToString();
MessageBox.Show(thePayeeId);
}
What is showing in the messageBox is the name of the column (P_Id) not the
value of the column (e.g. "D").
Have I correctly initialised the variable in my frmMain_Load method, and if
so, why is the value of the column not being shown?
Thanks