I have a ComboBox that I populate using a DataSource (an ArrayList of
objects of the same type.)
When I add and remove items in the data source array list, I can't get the
list of items shown in the ComboBox to update automatically. I had trouble
getting the DataSource to take when I first created this ComboBox (a few
weeks ago), and the only way I found to get it to work is to set the Parent
property (and then I handled the ParentChanged event and set the DataSource,
DisplayMember, ValueMember, etc., there.
Do I have to set the Parent every time I make changes to the DataSource to
get the ComboBox to repopulate, or is there a better way?
Thanks,
cj 2 2783
cj,
Instead of binding to an ArrayList, create a shell for the ArrayList
which implements IBindingList and binds to that.
Or, in .NET 2.0, use the generic BindingList class and bind to that.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"cj" <ch*********@chrisandkaren.ca> wrote in message
news:OV**************@TK2MSFTNGP09.phx.gbl... I have a ComboBox that I populate using a DataSource (an ArrayList of objects of the same type.)
When I add and remove items in the data source array list, I can't get the list of items shown in the ComboBox to update automatically. I had trouble getting the DataSource to take when I first created this ComboBox (a few weeks ago), and the only way I found to get it to work is to set the Parent property (and then I handled the ParentChanged event and set the DataSource, DisplayMember, ValueMember, etc., there.
Do I have to set the Parent every time I make changes to the DataSource to get the ComboBox to repopulate, or is there a better way?
Thanks, cj
Thanks! I'll try out the IBindingList.
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:ey**************@TK2MSFTNGP09.phx.gbl... cj,
Instead of binding to an ArrayList, create a shell for the ArrayList which implements IBindingList and binds to that.
Or, in .NET 2.0, use the generic BindingList class and bind to that.
Hope this helps.
-- - Nicholas Paldino [.NET/C# MVP] - mv*@spam.guard.caspershouse.com
"cj" <ch*********@chrisandkaren.ca> wrote in message news:OV**************@TK2MSFTNGP09.phx.gbl...I have a ComboBox that I populate using a DataSource (an ArrayList of objects of the same type.)
When I add and remove items in the data source array list, I can't get the list of items shown in the ComboBox to update automatically. I had trouble getting the DataSource to take when I first created this ComboBox (a few weeks ago), and the only way I found to get it to work is to set the Parent property (and then I handled the ParentChanged event and set the DataSource, DisplayMember, ValueMember, etc., there.
Do I have to set the Parent every time I make changes to the DataSource to get the ComboBox to repopulate, or is there a better way?
Thanks, cj
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: PeterZ |
last post by:
G'day,
After doing much searching and pinching bits of ideas from here there and
everywhere I came up with a fairly 'clean' solution of including a comboBox
into a dataGrid column.
You can...
|
by: pmcguire |
last post by:
I have derived a ComboBoxColumnStyle that inherits DataGridColumnStyle. It works fine except for one behavior. If the user selects a new value from the ComboBox's pulldown list on a brand new...
|
by: pmcguire |
last post by:
I have 2 bound ComboBoxes. I want the datasource of the second to be limited
by the selection made in the first. I can do this by responding to the
SelectionIndexChanged event on the first, but...
|
by: jon f kaminsky |
last post by:
Hi-
I've seen this problem discussed a jillion times but I cannot seem to
implement any advice that makes it work. I am porting a large project from
VB6 to .NET. The issue is using the combo box...
|
by: JJGarcia |
last post by:
Hi Everyone,
I'll try to explain the process I'm following, I'm new to this so I'm
triying the easy way first, probably the lasyest too!
I created a new Project, drag in to it a SQLConnection,...
|
by: Magnus |
last post by:
Im using a set combobox (ComboBox1) to provide a selection of records from a
database table. I have a typed dataset (DataSet1) that contains the typed
datatable (DataTable1) that the combobox is...
|
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...
|
by: Crazy Cat |
last post by:
Hi all,
I have combobox that is bound to a custom object collection thusly
Dim collection As List(Of StructureType) =
StructureType.FindStructureTypes(SharedObjects.StructureTypes,...
|
by: Andrus |
last post by:
I need to enter null value from combobox to business object property.
My combobox datasource does not contain ValueMember with null value.
So I tried to create combobox which stores null to bound...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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: 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...
| |