473,834 Members | 2,148 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

BindingList vs. List

I am trying to decide whether to use a
system.Componen tModel.BindingL ist(of T) or a
Sytem.Collectio ns.Generic.List (of T) for a custom collection. In
testing a simple, read-only data binding to a data grid view - they
both work. Are there aspects of databinding that the regular list will
not support and vice-versa, is there any reason to choose a regular
list over the bindinglist? -Jeff

Feb 23 '07 #1
6 16841
The bindinglist implements the IBindingList interface, so it has a bunch of
properties, methods, events, etc., that you can use. If you don't need
them, a generic list(Of T) will work fine.

For example, I use business objects, and I create BindingList(Of Customer)
to bind to a datagridview so I can capture the update events.

Robin S.
Ts'i mahnu uterna ot twan ot geifur hingts uto.
-----------------------------------------------
"jwilson128 " <jw********@yah oo.comwrote in message
news:11******** **************@ p10g2000cwp.goo glegroups.com.. .
>I am trying to decide whether to use a
system.Componen tModel.BindingL ist(of T) or a
Sytem.Collectio ns.Generic.List (of T) for a custom collection. In
testing a simple, read-only data binding to a data grid view - they
both work. Are there aspects of databinding that the regular list will
not support and vice-versa, is there any reason to choose a regular
list over the bindinglist? -Jeff

Feb 23 '07 #2
On Feb 23, 10:50 am, "RobinS" <Rob...@NoSpam. yah.nonewrote:
The bindinglist implements the IBindingList interface, so it has a bunch of
properties, methods, events, etc., that you can use. If you don't need
them, a generic list(Of T) will work fine.

For example, I use business objects, and I create BindingList(Of Customer)
to bind to a datagridview so I can capture the update events.

Robin S.
Ts'i mahnu uterna ot twan ot geifur hingts uto.
-----------------------------------------------"jwilson128 " <jwilson...@yah oo.comwrote in message

news:11******** **************@ p10g2000cwp.goo glegroups.com.. .
I am trying to decide whether to use a
system.Componen tModel.BindingL ist(of T) or a
Sytem.Collectio ns.Generic.List (of T) for a custom collection. In
testing a simple, read-only data binding to a data grid view - they
both work. Are there aspects of databinding that the regular list will
not support and vice-versa, is there any reason to choose a regular
list over the bindinglist? -Jeff- Hide quoted text -

- Show quoted text -
So I'm not giving anything up by using the bindinglist as opposed to
the regular list?

Feb 23 '07 #3

"jwilson128 " <jw********@yah oo.comwrote in message
news:11******** **************@ 8g2000cwh.googl egroups.com...
On Feb 23, 10:50 am, "RobinS" <Rob...@NoSpam. yah.nonewrote:
>The bindinglist implements the IBindingList interface, so it has a bunch
of
properties, methods, events, etc., that you can use. If you don't need
them, a generic list(Of T) will work fine.

For example, I use business objects, and I create BindingList(Of
Customer)
to bind to a datagridview so I can capture the update events.

Robin S.
Ts'i mahnu uterna ot twan ot geifur hingts uto.
-----------------------------------------------"jwilson128 "
<jwilson...@ya hoo.comwrote in message

news:11******* *************** @p10g2000cwp.go oglegroups.com. ..
>I am trying to decide whether to use a
system.Componen tModel.BindingL ist(of T) or a
Sytem.Collectio ns.Generic.List (of T) for a custom collection. In
testing a simple, read-only data binding to a data grid view - they
both work. Are there aspects of databinding that the regular list will
not support and vice-versa, is there any reason to choose a regular
list over the bindinglist? -Jeff- Hide quoted text -

- Show quoted text -

So I'm not giving anything up by using the bindinglist as opposed to
the regular list?
I think a BindingList is kind of like a regular list on steroids. ;-)

The performance might not be as good, but I doubt it would be noticeable.

Robin S.
Feb 23 '07 #4
jWilson,

Are we not talking about apples and pears.

A generic list is a collection class.
http://msdn2.microsoft.com/en-us/library/6sh2ey19.aspx

The Bindinglist a more generic way of using databinding
http://msdn2.microsoft.com/en-us/library/ms132679.aspx

In other words a generic list can be bind to da bindingsource, however as
well using the generic bindinglist (I never did the latter by the way).

Cor

"jwilson128 " <jw********@yah oo.comschreef in bericht
news:11******** **************@ p10g2000cwp.goo glegroups.com.. .
>I am trying to decide whether to use a
system.Componen tModel.BindingL ist(of T) or a
Sytem.Collectio ns.Generic.List (of T) for a custom collection. In
testing a simple, read-only data binding to a data grid view - they
both work. Are there aspects of databinding that the regular list will
not support and vice-versa, is there any reason to choose a regular
list over the bindinglist? -Jeff

Feb 24 '07 #5
I'm not sure I understand - please let me attempt to clarify:

I have a custom business object call Loan. I then want to implement a
custom collection of Loan objects where i can further define business
logic that relates to the collection. Knowing that i will want to bind
the collection of Loans to a form datagrid, should I implement my
custom collection (and relating business logic) using a BindingList as
opposed to a generic List? If this line of thinking is off, I'd love
to understand why? Thanks. -Jeff

Feb 27 '07 #6
Yes, you should use a BindingList(Of Loan). Define your class like this:

Public Class LoanList
Inherits BindingList(Of Loan)

End Class

If you want to figure out how to do upgrades to a DataGridView bound to
your LoanList, check out Brian Noyes' Data Binding book. You can post
back, and if I can figure out how to condense it, I'll post it.

Robin S.
----------------------------------------
"jwilson128 " <jw********@yah oo.comwrote in message
news:11******** **************@ q2g2000cwa.goog legroups.com...
I'm not sure I understand - please let me attempt to clarify:

I have a custom business object call Loan. I then want to implement a
custom collection of Loan objects where i can further define business
logic that relates to the collection. Knowing that i will want to bind
the collection of Loans to a form datagrid, should I implement my
custom collection (and relating business logic) using a BindingList as
opposed to a generic List? If this line of thinking is off, I'd love
to understand why? Thanks. -Jeff

Feb 27 '07 #7

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

Similar topics

4
3524
by: hazz | last post by:
The data access layer below returns, well, a mess as you can see on the last line of this posting. What is the best way to return customer objects via a datareader from the data layer into my view and bind them to a datagrid using BindingList. I am in need of an epiphany here. Thank you. -Greg ******************BIND ARRAY OF CUSTOMER OBJECTS TO DATAGRID ************************ private Customer c; c =...
0
2637
by: g18c | last post by:
Hi, i have a class which has a property which is a list of items. I want to be able to set this item list from a set of items (in this case list2 as shown in the code below) from a drop down combo box. This will allow me to enter valid items in a seperate form, then when adding a new Class1 object i can select from one of the valid Class2 items in the dropdown list. I hope this makes sense, i have got partway there but i have lost...
1
3046
by: Dave Booker | last post by:
Is there a reason why the BindingList constructor doesn't create a new BindingList? Create a form with four ListBoxes and the following will result in them all containing the exact same thing. The expected behavior would be for each of the first three to contain different sets numbers. public Form1() { InitializeComponent();
1
3110
by: Pieter | last post by:
Hi, I have a custom List that inherits from BindingList. It has some methods overloaded, like the Add/Insert/etc to add and remove some eventhandlers when adding or removing an item T of the list. The problem happens when: - I use such a BindingList as DataSource for a BindingSource. - Add this BindingSource as DataSource for a DataGridView. - And go to the NewRow and add a new row in the DataGridView.
1
4443
by: Merk | last post by:
I need to show users a list of "Person" attributes in a grid. I currently have a custom "Person" class that mostly has a bunch of string properties (firstName, lastName, etc). While I want to have a collection of Person objects behind the scenes, I want for only a specific subset to appear in the grid at any given time. The subset would be determined by rules such as (ID Number Between 100 and 130, or lastName begins with "SCH"), and...
1
1493
by: Pieter | last post by:
Hi, I use a customized Generic List (VB.NET 2.0) inherited from BindingList(Of T). I made some methods in this BindingList, to allow me to do some standard functions on the BindingList-Items. One of them is for instance SumItems, which returns me the sum of a given Property of all the Items in the List.
1
1829
by: Rick | last post by:
VS.net 2005 I'm using a bindinglist(of T) to bind to various controls on a WinForm. I use the name/value pairs in the "type" for the displayMember and ValueMember of say a ComboBox control. For example I might load the TermsNumber and TermsDescription from a database into the binding list and then use the combobox to feed into a customer setup form for default terms and for a order setup form for the individual order terms.
3
13941
by: cowznofsky | last post by:
I'm getting data in a generic list class, which I'm not going to change. I would like to use it as a datasource for a datagrid or a gridview, but it doesn't implement IEnumerable. I'm wondering if there's a simple technique that would allow me to get the data into the datagrid.
11
76319
by: dave18 | last post by:
Hello all! I found a solution to my original question, but there's still so much I don't understand about it, I thought I'd give this forum a try. At the very least, maybe it will help someone else who got stumped like I did. It seems so simple... binding a DataGridView to a List<T>. These are the two general problems that I kept running into: (1) When the data in the list updated, the data on the screen did not update. (2) When I...
0
9796
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9643
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10786
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, 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...
0
10503
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10214
tracyyun
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...
0
9326
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7754
isladogs
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...
0
6951
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
3
3079
bsmnconsultancy
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...

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.