473,387 Members | 1,722 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Multiple Comboboxes bound to one Dataview

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

Sep 29 '07 #1
3 1845
Randy,

Here is a similar question and the answer might apply to your situation:

http://www.eggheadcafe.com/software/...on-really.aspx

Kerry Moorman
"Randy" wrote:
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

Sep 29 '07 #2
Randy,

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

Cor
Sep 29 '07 #3
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

Sep 29 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: RPI_alum | last post by:
I've been experiencing some frustrating behavior that I believe may be a MS bug in the Framework. Has anyone else experienced this, know a better way to resolve it, or if it is an actual MS bug ...
1
by: Kevin | last post by:
I have a 4 tab form each with different dataviews attached to a datagrid. On the last tab, I have a dataview attached to a datagrid and 2 comboxes that are bound to the same dataset representing 2...
4
by: Jazper Manto | last post by:
hi i bounded the same dataview to 2 different comboboxes. now, when i change the selectedIndex of combobox1, it automatically changes the selectedIndex of combobox2. does this mean, that the...
11
by: Steve B. | last post by:
How can I keep the ComboBox textbox empty of datasource items when my local application starts AND keep them empty even after the user clicks different Tabs on the form. I welcome any questions....
5
by: Phil | last post by:
Hi all I'm new to vb but have a little experience in vba im using vb.net my question is with comboboxes the fist combo box lists the manufactures when a selection is made the second combox...
5
by: Ron L | last post by:
I have a DataTable that is being maintained in a Model class. I also have a View class which creates a DataView from the DataTable that the Model passes it. The view class then has methods to...
1
by: TheMadHatter | last post by:
I have an array of a custom obj which I am trying to use in multiple comboBoxes without creating multiple copies, but if I put the datasource of the comboboxes to the same array, then at runtime...
10
by: Marc R. | last post by:
Hi all, I edit records using a form that have multiple control bind on Dataview, But I don't want to update right always to database, I would like to delay until all Changes (add all new...
4
by: ECathell | last post by:
I am trying to databind 2 combo boxes to the same datasource but different fields using the same lookup table. The information in combobox2 is duplicating combobox 1(ie it appears to be gathering the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.