Multiple Comboboxes bound to one Dataview

R

Randy

I have a routine that creates a series of comboboxes, each of which is
bound to a common dataview. Everything used to work fine, but now,
when I change the value of any of the comboboxes, the value in ALL of
the comboboxes changes to the new value. I have boiled down the code
to the simplest lines and placed it on its own form, but I still get
the same behavior. I have stepped through each line of code, and I
don't see any other lines running other than the ones that I show here
and those that fill the tableadapter. Can anybody help me with this?

Private Sub test_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load
Me.TaJobs1.Fill(Me.TimsheetsDataSet1.Jobs)

Dim vueJob As New DataView
vueJob.Table = Me.TimsheetsDataSet1.Jobs
vueJob.Sort = "JobName"

For x As Integer = 1 To 4
Dim newJobCbo As New ComboBox
With newJobCbo
.Name = "cboJob" & x
.Size = New System.Drawing.Size(121, 21)
.Location = New Point(70, 60 + x * 23)
.DataSource = vueJob
.DisplayMember = "JobName"
End With
Controls.Add(newJobCbo)
Next

End Sub

Thanks,
Randy
 
C

Cor Ligthert[MVP]

Randy,

When you have two comboboxes than you need two new created dataviews.

Cor
 
R

Randy

Thank you, Kerry. That solved it. All I had to do was to add the
line

.BindingContext = New BindingContext

within my With-End With statement.

Randy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top