PC Review


Reply
Thread Tools Rate Thread

Datagridview and collection in VB.net

 
 
Vanny
Guest
Posts: n/a
 
      7th May 2009
How to show all rows in the datagridview from a collection? When I try to
populate the datagridview from a list(of T) collection, I can see many rows
but they all the same. It looks like it shows only the last element of the
list.

What I did in code is just build a collection of my class as list and
assign it to the datagridview.datasource. What else should I do?

Thanks in advance for your help

Vanny


 
Reply With Quote
 
 
 
 
Cor Ligthert[MVP]
Guest
Posts: n/a
 
      8th May 2009
Vanny,

When you show the code which set the list to the datasource, then it is
probably easier for us to give you some help with that.

Cor

"Vanny" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> How to show all rows in the datagridview from a collection? When I try to
> populate the datagridview from a list(of T) collection, I can see many
> rows but they all the same. It looks like it shows only the last element
> of the list.
>
> What I did in code is just build a collection of my class as list and
> assign it to the datagridview.datasource. What else should I do?
>
> Thanks in advance for your help
>
> Vanny
>


 
Reply With Quote
 
Vanny
Guest
Posts: n/a
 
      8th May 2009
Thank you for looking at my question. It is working now, I think it was an
error in the collection.

Vanny

"Cor Ligthert[MVP]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Vanny,
>
> When you show the code which set the list to the datasource, then it is
> probably easier for us to give you some help with that.
>
> Cor
>
> "Vanny" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> How to show all rows in the datagridview from a collection? When I try
>> to populate the datagridview from a list(of T) collection, I can see many
>> rows but they all the same. It looks like it shows only the last element
>> of the list.
>>
>> What I did in code is just build a collection of my class as list and
>> assign it to the datagridview.datasource. What else should I do?
>>
>> Thanks in advance for your help
>>
>> Vanny
>>

>



 
Reply With Quote
 
Cor Ligthert[MVP]
Guest
Posts: n/a
 
      9th May 2009
Robin,

Why?

By the way the OP uses a geneneric collection with a bindingsource (the
latter I assume, the OP did not show that), the recommended way by
Microsoft.
The generic collection BindList is described for special situations,
therefore I am curious why it is for you in general better?

Cor

"RobinDotNet" <(E-Mail Removed)> wrote in message
news:yK-(E-Mail Removed)...
> For your collection, use a BindingList<T>, not just a regular collection.
> It works better.
>
> RobinDotNet
> ----------------
> "Vanny" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
>> Thank you for looking at my question. It is working now, I think it was
>> an error in the collection.
>>
>> Vanny
>>
>> "Cor Ligthert[MVP]" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>>> Vanny,
>>>
>>> When you show the code which set the list to the datasource, then it is
>>> probably easier for us to give you some help with that.
>>>
>>> Cor
>>>
>>> "Vanny" <(E-Mail Removed)> wrote in message
>>> news:(E-Mail Removed)...
>>>> How to show all rows in the datagridview from a collection? When I try
>>>> to populate the datagridview from a list(of T) collection, I can see
>>>> many rows but they all the same. It looks like it shows only the last
>>>> element of the list.
>>>>
>>>> What I did in code is just build a collection of my class as list and
>>>> assign it to the datagridview.datasource. What else should I do?
>>>>
>>>> Thanks in advance for your help
>>>>
>>>> Vanny
>>>>
>>>

>>
>>

>


 
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
DatagridView - modifying the data collection =?Utf-8?B?VmluYXkgS2luYWdp?= Microsoft Dot NET Framework Forms 1 12th Oct 2007 08:56 PM
DataGridView - Custom Collection - Remove New Row from Collection =?Utf-8?B?V2ViYmVydA==?= Microsoft Dot NET 0 8th Sep 2006 12:09 PM
Collection(Of T) sortable in DataGridView Pieter Microsoft Dot NET Framework 4 16th Nov 2005 09:34 AM
Collection(Of T) sortable in DataGridView Pieter Microsoft Dot NET 4 16th Nov 2005 09:34 AM
Collection(Of T) sortable in DataGridView Pieter Microsoft VB .NET 4 16th Nov 2005 09:34 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:44 AM.