I have this Combobox
filled with objects
And Upon selecting a certain object from the combobox
I would like to show Text in a Textbox
, but for some reason I can't get my selection through.
This is what is in my combobox
:
private void showBirds()
{
cboBirds.Items.Clear();
foreach (Bird b in Bird.ReadBirdCSV(txtFile.Text))
{
cboBirds.Items.Add(b);
}
}
It basically shows the names of birds from the Objects Bird.
private void cboBirds_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
//WHAT DO I WRITE HERE TO GET txbGender TO SHOW THE GENDER?
foreach (Bird b in cboBirds.Items)
{
Console.WriteLine(b.Gender +" - " + b.Name +" - " + b.Risk + " - " +b.Reference);
}
//^This shows all info on every bird.
}
I'm sure it's really simple, I just can't seem to figure it out.