Click here to Skip to main content
15,881,248 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I filling up ComboBoxes with enums and pass the collected data into my DB manager class like this:

C#
(CountryOfEarth)Form_Animals_Add_Country.SelectedIndex


But how to do it if the data is not from enum otherwise from the database? I mean just get names from the database and filling up the ComboBox where the user can select one item. Then save into the database.

What is missing:

C#
(???)Form_Animals_Add_Country.SelectedIndex


What I have tried:

C#
(DBmanager.BindToComboBox(ComboBox Form_Animals_Add_Country))Form_Animals_Add_Country.SelectedIndex
Posted
Updated 15-Mar-22 9:32am
v3

1 solution

See example here: Fill ComboBox From Sql Server On C#[^]
And if you have the time, study this CodeProject article: A Detailed Data Binding Tutorial[^]
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900