G
Guest
Say cbRoadwayType is my combobox:
for (int i = 0; i < cbRoadwayType.Items.Count; i++)
{
cbRoadwayType.SelectedIndex = i;
int val = (int)cbRoadwayType.SelectedItem // INVALID EXCEPTION cast
if (val != FILTER_ALL && val != FILTER_NOT_SET)
{
roadwayList.Add(val);
}
}
But, I get an invalid exception cast. How do I just get the value of the
combobox item, based on an index?!
for (int i = 0; i < cbRoadwayType.Items.Count; i++)
{
cbRoadwayType.SelectedIndex = i;
int val = (int)cbRoadwayType.SelectedItem // INVALID EXCEPTION cast
if (val != FILTER_ALL && val != FILTER_NOT_SET)
{
roadwayList.Add(val);
}
}
But, I get an invalid exception cast. How do I just get the value of the
combobox item, based on an index?!