//I have the following data bind to a comboBox
public struct DataContainer
{
private string pvrKey, prvValue;
public DataContainer(string parKey , string parValue)
{
this.pvrKey = parKey ; this.prvValue = parValue ;
}
public string getKey { get { return pvrKey; } }
public string getValue { get { return prvValue; } }
}
ArrayList CmbData = new ArrayList ();
while (dr.Read())
{
CmbData.Add (new DataContainer(Convert.ToString(dr.GetValue(dr.GetOrdinal("CustKey")), Convert.ToString(dr.GetValue(dr.GetOrdinal("CustName"))));
}
this.cmbAccountName.DataSource = CmbData;
this.cmbAccountName.DisplayMember = "getValue";
// When the user selects an item from the combobox
// How can I retrieve the "Key" value of the object the user selected?
public struct DataContainer
{
private string pvrKey, prvValue;
public DataContainer(string parKey , string parValue)
{
this.pvrKey = parKey ; this.prvValue = parValue ;
}
public string getKey { get { return pvrKey; } }
public string getValue { get { return prvValue; } }
}
ArrayList CmbData = new ArrayList ();
while (dr.Read())
{
CmbData.Add (new DataContainer(Convert.ToString(dr.GetValue(dr.GetOrdinal("CustKey")), Convert.ToString(dr.GetValue(dr.GetOrdinal("CustName"))));
}
this.cmbAccountName.DataSource = CmbData;
this.cmbAccountName.DisplayMember = "getValue";
// When the user selects an item from the combobox
// How can I retrieve the "Key" value of the object the user selected?