private Animal AddAnimal()
string name = txtName.Text;
double age = Convert.ToDouble(txtAge.Text);
CategoryType animalCategory = (CategoryType)lstCategory.SelectedIndex;
Animal animalItem = null;
Bird.BirdSpecies birdSpecie = (Bird.BirdSpecies)Enum.Parse(typeof(Bird.BirdSpecies), lstCategory.SelectedItem.ToString());
animalItem = Bird.BirdFactory.CreateBird(birdSpecie);
My problem mainly revolves around trying to bind the "new" datasource for my second list depending on the choice in the first list. For instance if the bird category is chosen, how would I go about to bind the specific enums (e.g. bee, butterfly) to the second list? Do I need to use the eventhandler SelectedIndexChanged, if so, how would that be done most plausible?
Having the method run under SelectedIndexChanged seems to work. However, the binding part is more troublesome, I can't figure it out. It seems abundant to have "lstCategory.SelectedItem" go off as the string value in Enum.Parse, or am I out in the dark?
Edited 3-Feb-13 10:35am
You need to use the onselectedindexchanged event to select your new category and then run your add animal from there.
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)