Hi I'm having a problem when I want change the DataSource of the control.
I want to filter in my collection depending on the first selected item, for example.
I have 3 DataTables: 1 - All People, 2 - Men, 3 - Women.
First will be charged with Table 1 - All and and depending on the first selection I make, I want to update the DataSource with 2 - Men or 3 - Women.
I encounter problems when I try to change it. I'm doing at the event SelectionChanged, I note that have selected an item and the text ends with the delimiter character, then analyze and select the text which will be my new table and to modify the datasource throws ArgumentOutOfRangeException.
private
void
rACBox_SelectionChanged(
object
sender, SelectionChangedEventArgs e)
{
if
(
this
.rACBox.Items.Count == 1 &&
this
.rACBox.Text.EndsWith(
"$"
))
{
if
(
this
.IsMen(
this
.rACBox.Items[0].Value.ToString())
{
rACBox.AutoCompleteDataSource =
new
BindingSource(
this
.Men);
}
else
{
rACBox.AutoCompleteDataSource =
new
BindingSource(
this
.Women);
}
}
}
Thx
Regards.