0

i got create combobox and i want show item at combobox from my database data.

i set datasource from properties..
but for displaymember i try to use coding.

cmbPelan.DisplayMember = "Pelan"
cmbPelan.SelectedIndex = -1

but result like image me attach.
i want my combobox show item like
1
2
3

anyone can help me?

2
Contributors
4
Replies
5
Views
8 Years
Discussion Span
Last Post by ggl0rd
0

my coding for combobox just that..
becouse for that combobox datasource i set at properties.

0

So your just trying to populate a combo box then? First you need to set up your sql connection object, then your sql data adapter object. Make sure your able to connect to your database. Open a connection on your form load event then try something like this:

Dim "yourdataset" as new dataset

SqlDataadapter1.selectcommand.commandtext = "Your select statement used for the combobox"

SqlDataadapter1.fill("Your dataset")

Combobox1.DataSource = yourdataset.tables(0)
Combobox1.displaymember = yourdataset.tables(0).Columns(0).ColumnName
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.