D
Daniel Manes
Take one DataGridView, add one column that contains cities, add another
that contains countries, add another that contains locales (states,
provinces, territories, etc.).
Now, make the Country and Locale columns ComboBox columns, and bind the
Country column to a Country BindingSource and the Locale column to a
Locale BindingSource.
Now run it. Pretend you are a user trying to add a new record. You
enter "San Diego" for the city, you select "United States" for the
Country. Then you go to select a state but the Locale column has every
locale of every country (almost 4,000 items), not just the 50 states.
Not good.
So, add an event handler that places a filter on the BindingSource to
show only locales belonging to the selected country whenever the user
clicks or enters a Locale cell in the DataGridView.
Run it again. The whole thing goes bananas. "Invalid cell" errors all
over the place. I think this is because the filter applies to the
*whole* Locale column, not just the ComboBox for the cell begin edited.
So if one of the rows contains Berlin but all the combo boxes in the
Locale column are filtered for United States, the validator gets angry.
So this is where I could use some help/advice. Is there any way to set
a filter for just the one cell (rather than the whole column)? Maybe
give that cell its own BindingSource?
A free box of my eternal gratitude to anyone who can help
-Dan
that contains countries, add another that contains locales (states,
provinces, territories, etc.).
Now, make the Country and Locale columns ComboBox columns, and bind the
Country column to a Country BindingSource and the Locale column to a
Locale BindingSource.
Now run it. Pretend you are a user trying to add a new record. You
enter "San Diego" for the city, you select "United States" for the
Country. Then you go to select a state but the Locale column has every
locale of every country (almost 4,000 items), not just the 50 states.
Not good.
So, add an event handler that places a filter on the BindingSource to
show only locales belonging to the selected country whenever the user
clicks or enters a Locale cell in the DataGridView.
Run it again. The whole thing goes bananas. "Invalid cell" errors all
over the place. I think this is because the filter applies to the
*whole* Locale column, not just the ComboBox for the cell begin edited.
So if one of the rows contains Berlin but all the combo boxes in the
Locale column are filtered for United States, the validator gets angry.
So this is where I could use some help/advice. Is there any way to set
a filter for just the one cell (rather than the whole column)? Maybe
give that cell its own BindingSource?
A free box of my eternal gratitude to anyone who can help
-Dan