Question fill up combobox after selected index changed

Black.Red.Thunder

New member
Joined
Feb 24, 2009
Messages
1
Programming Experience
1-3
Hi,

by using a data source in ADO.net I made a program, but their is still something going wrong. When I dragged the combobox in the 'data sources' into the form, it generated automatically this code:
VB.NET:
    Private Sub frmMuziekcollectie_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'TODO: This line of code loads data into the 'DTSMuziekcollectie.tblLinks' table. You can move, or remove it, as needed.
        Me.TblLinksTableAdapter.Fill(Me.DTSMuziekcollectie.tblLinks)
        'tableadapters vullen
        Me.TblCdInhoudTableAdapter.Fill(Me.DTSMuziekcollectie.tblCdInhoud)
        Me.TblCategorieenTableAdapter.Fill(Me.DTSMuziekcollectie.tblCategorieen)

When I load the program, it works all; this is what's in the combobox while running:
classics
rock
celtic
pop

But when I click on 'rock' in the combobox, then it's like this in the combobox:
rock
rock
celtic
pop

What am I doing wrong?
 
Ideally, I need to see your project to fix it. The problem is that you seem to be wanting the combobox to show categories out of one table but edit values in another table

In this case you need:

combo.DataSource = the datatable of all the categories
combo.DisplayMember = "The name of the column with the nice name"
combo.ValueMember = "The name of the column with the ID"
combo.SelectedValue binding bound to the table you wish to edit
combo.Text NOT BOUND (it is by default)
 
Back
Top