473,385 Members | 2,013 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,385 software developers and data experts.

BindingList vs. List

I am trying to decide whether to use a
system.ComponentModel.BindingList(of T) or a
Sytem.Collections.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 16799
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********@yahoo.comwrote in message
news:11**********************@p10g2000cwp.googlegr oups.com...
>I am trying to decide whether to use a
system.ComponentModel.BindingList(of T) or a
Sytem.Collections.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...@yahoo.comwrote in message

news:11**********************@p10g2000cwp.googlegr oups.com...
I am trying to decide whether to use a
system.ComponentModel.BindingList(of T) or a
Sytem.Collections.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********@yahoo.comwrote in message
news:11**********************@8g2000cwh.googlegrou ps.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...@yahoo.comwrote in message

news:11**********************@p10g2000cwp.googleg roups.com...
>I am trying to decide whether to use a
system.ComponentModel.BindingList(of T) or a
Sytem.Collections.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********@yahoo.comschreef in bericht
news:11**********************@p10g2000cwp.googlegr oups.com...
>I am trying to decide whether to use a
system.ComponentModel.BindingList(of T) or a
Sytem.Collections.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********@yahoo.comwrote in message
news:11**********************@q2g2000cwa.googlegro ups.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
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...
0
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...
1
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. ...
1
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...
1
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...
1
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....
1
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. ...
3
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...
11
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...
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:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
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
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?
1
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...
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,...

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.