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
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

mikerRank #2,843 · 502 reputationPosted Feb 11, 2005, 7:24 AM EST
marcelvojta25 reputationPosted Feb 11, 2005, 7:51 AM EST