P
Paolo
From a combo box I use the SelectedValue property as a parameter to a query
from which I populate a ListBox
private void cmbxCategory_SelectedValueChanged(object sender, EventArgs e)
{
string theCatId = cmbxCategory.SelectedValue.ToString();
var getSubCat =
from sc in dataSet.SubCategory
where (theCatId == sc.S_CatId)
select sc.S_Description; // get the Description
lsbxSubCat.DataSource = getSubCat.ToList(); // put Description
in ListBox
}
I then want to get the data from the ValueMember of the ListBox's selected
item.
However, using MessageBox to display my required result is showing "".
private void lsbxSubCat_SelectedValueChanged(object sender,
EventArgs e)
{
string theSubCatId = lsbxSubCat.SelectedValue.ToString(); // get
the Id for the Description
MessageBox.Show(theSubCatId);
}
Can anyone point out any obvious errors?
Thanks
from which I populate a ListBox
private void cmbxCategory_SelectedValueChanged(object sender, EventArgs e)
{
string theCatId = cmbxCategory.SelectedValue.ToString();
var getSubCat =
from sc in dataSet.SubCategory
where (theCatId == sc.S_CatId)
select sc.S_Description; // get the Description
lsbxSubCat.DataSource = getSubCat.ToList(); // put Description
in ListBox
}
I then want to get the data from the ValueMember of the ListBox's selected
item.
However, using MessageBox to display my required result is showing "".
private void lsbxSubCat_SelectedValueChanged(object sender,
EventArgs e)
{
string theSubCatId = lsbxSubCat.SelectedValue.ToString(); // get
the Id for the Description
MessageBox.Show(theSubCatId);
}
Can anyone point out any obvious errors?
Thanks