PC Review


Reply
Thread Tools Rate Thread

BindingList vs. List

 
 
jwilson128
Guest
Posts: n/a
 
      23rd Feb 2007
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

 
Reply With Quote
 
 
 
 
RobinS
Guest
Posts: n/a
 
      23rd Feb 2007
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>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
>



 
Reply With Quote
 
jwilson128
Guest
Posts: n/a
 
      23rd Feb 2007
On Feb 23, 10:50 am, "RobinS" <Rob...@NoSpam.yah.none> wrote:
> 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.com> wrote in message
>
> news:(E-Mail Removed)...
>
>
>
> >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?

 
Reply With Quote
 
RobinS
Guest
Posts: n/a
 
      23rd Feb 2007

"jwilson128" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> On Feb 23, 10:50 am, "RobinS" <Rob...@NoSpam.yah.none> wrote:
>> 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.com> wrote in message
>>
>> news:(E-Mail Removed)...
>>
>>
>>
>> >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.


 
Reply With Quote
 
Cor Ligthert [MVP]
Guest
Posts: n/a
 
      24th Feb 2007
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" <(E-Mail Removed)> schreef in bericht
news:(E-Mail Removed)...
>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
>



 
Reply With Quote
 
jwilson128
Guest
Posts: n/a
 
      27th Feb 2007
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

 
Reply With Quote
 
RobinS
Guest
Posts: n/a
 
      27th Feb 2007
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Linq to BindingList Paul Microsoft VB .NET 0 16th Feb 2010 09:22 AM
Just checking: BindingList<T> is the only generic list supportingchange notifications? Steve K Microsoft C# .NET 1 8th Apr 2008 08:46 AM
Converting List<T> structures to BindingList<T> =?Utf-8?B?U3RldmUgQnVnZGVu?= Microsoft Dot NET Framework Forms 3 16th Jun 2007 05:03 PM
BindingList<T> and .FindAll() Merk Microsoft Dot NET Framework Forms 1 11th Dec 2006 09:17 PM
list vs bindinglist Microsoft Dot NET Framework 3 1st Nov 2005 09:10 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:56 AM.