get values of non-display columns of actual data row
Hi,
I am beginner in C# and I can't find solution of this:
I have data table, which is bind to ComboBox
DataSet ds;
.
.
cmbXXX.DataSource = ds.Tables["TableName"];
cmbXXX.DisplayMember = "Column1";
I'd like to get the value of other column (for example Column2) after the selected item in the ComboBox is changed.
I can find it only this way ...
foreach (DataRow dr in ds.Tables["..."].Rows)
{
if (dr["Column1"].ToString() == cmbXXX.Text)
// the code for found row
// use row value of dr["Column2_name"]
}
is ther more effective way ?
Thanx