Hello,
I have 6 comboboxes, that I thought I could bind to the same datasource, and
have them display different 'selectedvalue' s', but apparently I can't...
My code is as follows:
dim drv as datarowview = me.listbox1.sel ecteditem
dim dtbDL as datatable = _dataset1.Table s(0)
dim dtvDL as new dataview(dtbDL)
dtvDL.RowFilter = "STR_ONE" = 'Matching Text'"
'Combobox 1
Me.cbo1.datasou rce = dtvDL
me.cbo1.ValueMe mber = "STR_DISPLAY_VA LUE"
me.cbo1.Display Member = "STR_DISPLAY_VA LUE"
me.cbo1.Selecte dValue = drv("ITEM_1_FRO M_DATABASE").To String
'Combobox 2
Me.cbo2.datasou rce = dtvDL
me.cbo2.ValueMe mber = "STR_DISPLAY_VA LUE"
me.cbo2.Display Member = "STR_DISPLAY_VA LUE"
me.cbo2.Selecte dValue = drv("ITEM_2_FRO M_DATABASE").To String
Obviously I'm not able to do this...whatever the value is in
ITEM_2_FROM_THE _DATABASE is displayed in both.
I want all 6 comboboxes to display the same drop downlist of (76) values,
but to display the corresponding value in the database for each item.
Make sense??
Do I need to declare a new dataview each time? and/or datatable??
Thanks!
amber 3 4586
Amber,
When I understand you well, than you can by creating for every combobox its
own dataview.
I hope this helps,
Cor
"amber" <am***@discussi ons.microsoft.c om> Hello, I have 6 comboboxes, that I thought I could bind to the same datasource, and have them display different 'selectedvalue' s', but apparently I can't...
My code is as follows:
dim drv as datarowview = me.listbox1.sel ecteditem dim dtbDL as datatable = _dataset1.Table s(0) dim dtvDL as new dataview(dtbDL) dtvDL.RowFilter = "STR_ONE" = 'Matching Text'"
'Combobox 1 Me.cbo1.datasou rce = dtvDL me.cbo1.ValueMe mber = "STR_DISPLAY_VA LUE" me.cbo1.Display Member = "STR_DISPLAY_VA LUE" me.cbo1.Selecte dValue = drv("ITEM_1_FRO M_DATABASE").To String
'Combobox 2 Me.cbo2.datasou rce = dtvDL me.cbo2.ValueMe mber = "STR_DISPLAY_VA LUE" me.cbo2.Display Member = "STR_DISPLAY_VA LUE" me.cbo2.Selecte dValue = drv("ITEM_2_FRO M_DATABASE").To String
Obviously I'm not able to do this...whatever the value is in ITEM_2_FROM_THE _DATABASE is displayed in both.
I want all 6 comboboxes to display the same drop downlist of (76) values, but to display the corresponding value in the database for each item.
Make sense?? Do I need to declare a new dataview each time? and/or datatable??
Thanks! amber
I'm not sure if this will help, but I was reading in Chris Sells 'Windows
Forms Binding in C#, footnote, page 482', that the data source is bound to
each combobox and is managed by a common Binding manager which in turn is
part of a Binding Context. The Binding amager keeps all comboboxes
synchronized to the same row in the database. However, if each combobox has
a different Binding context, hence a diferent Binding Manager, then the combo
boxes can show different rows from the same data source.
"amber" wrote: Hello, I have 6 comboboxes, that I thought I could bind to the same datasource, and have them display different 'selectedvalue' s', but apparently I can't...
My code is as follows:
dim drv as datarowview = me.listbox1.sel ecteditem dim dtbDL as datatable = _dataset1.Table s(0) dim dtvDL as new dataview(dtbDL) dtvDL.RowFilter = "STR_ONE" = 'Matching Text'"
'Combobox 1 Me.cbo1.datasou rce = dtvDL me.cbo1.ValueMe mber = "STR_DISPLAY_VA LUE" me.cbo1.Display Member = "STR_DISPLAY_VA LUE" me.cbo1.Selecte dValue = drv("ITEM_1_FRO M_DATABASE").To String
'Combobox 2 Me.cbo2.datasou rce = dtvDL me.cbo2.ValueMe mber = "STR_DISPLAY_VA LUE" me.cbo2.Display Member = "STR_DISPLAY_VA LUE" me.cbo2.Selecte dValue = drv("ITEM_2_FRO M_DATABASE").To String
Obviously I'm not able to do this...whatever the value is in ITEM_2_FROM_THE _DATABASE is displayed in both.
I want all 6 comboboxes to display the same drop downlist of (76) values, but to display the corresponding value in the database for each item.
Make sense?? Do I need to declare a new dataview each time? and/or datatable??
Thanks! amber This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: NCrum |
last post by:
I want to set the Default value of a Combobox for any changeable record and have got this working but it is totaly unsatisfactory
see the code below
I loop through the items in the Combo looking for a match between cVal and the selectedValue then stop when I do have a match
the obvious problem is that each iteration fires the selectedIndexChanged but also for a large list this will slow everything down.
There must be a better way
int...
|
by: Bruce |
last post by:
Hi, there,
I meet a problem about comboBox binding.
--------------------
Database: Northwind
Tables: 1) Products 2) Categories
I create a form (named "form1") to edit the record from Products table.
|
by: dbuchanan |
last post by:
VS2005
I've been reading all the help I can on the topic (MSDN, other) but I
can't make sense of this.
Desired behavior;
The user is to choose from the displayed list of the databound combobox
and the coresponding 'Id' from the lookup table is to be inserted into
the field of the new record.
I have two simple tables. "tblPerson" is the data table. The lookup
|
by: shumaker |
last post by:
I have a combobox that is very much like the one found in the RSS
project here:
http://msdn.microsoft.com/vstudio/express/visualCSharp/learning/
My projectNameComboBox basically is filled with a list of values from a
table, and as the user selects values, a datagrid displays related
records from another table because it is bound via FK relationship.
My table:
/****** Object: Table . Script Date: 06/19/2006
|
by: Joe |
last post by:
Hi
I am adding a class to a ComboBox - and all is fine except that I fill the
combobox on the
Form_Load Method and it causes the method
private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
To fire twice
Once when I comboBox2.DataSource = allMonths;
And again when I execute comboBox2.DisplayMember = "Name";
| |
by: Frnak McKenney |
last post by:
Can I use a bound ComboBox for both browsing and editing?
I'm working on a small, standalone database application using Visual
C#.NET 2003 and an Access data file.
In order to keep the number of different screens down to a minimum,
I'm trying to use the same Windows Forms for both browsing and for
updating. This works fine for TextBoxes, but I'm running into
problems with my DropDownLists (ComboBoxes).
|
by: active |
last post by:
I'm using a ComboBox to display objects of a class I've defined, say CQQ.
Works great except somehow I occasionally set an Item to a String object
instead of an object of type CQQ.
It looks like Text replaces an item or something like that.
This results in a runtime error at which time I learn that the item that
should be CQQ is a String.
|
by: Simon Tamman |
last post by:
I've come across an interesting bug.
I have workarounds but i'd like to know the root of the problem. I've
stripped it down into a short file and hope someone might have an idea about
what's going on.
It's a simple program that loads a control onto a form and binds "Foo"
against a combobox ("SelectedItem") for it's "Bar" property and a
datetimepicker ("Value") for it's "DateTime" property. The
DateTimePicker.Visible value is set to...
|
by: David Jackson |
last post by:
Hello,
I have an unbound DataGridView of which one of the columns is a ComboBox
colum containing category data, plus an additional option called <newSo
when the ComboBox is dropped down it looks like this
<new>
First
Second
Third
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |