PC Review


Reply
Thread Tools Rate Thread

ArrayLists and Datagrids

 
 
scorpion53061
Guest
Posts: n/a
 
      6th Oct 2003
I would like a suggestions on the best way to write 2 arraylists to a
datagrid or if it is even possible.

I would want to do AList.Item(0) = BList.Item(0) and trying to write them
both to a datagrid in seperate columns.
i was thinking about writing the arrays to a datatable in code and writing
that to the grid but I though that would be expensive.



 
Reply With Quote
 
 
 
 
Jay B. Harlow [MVP - Outlook]
Guest
Posts: n/a
 
      6th Oct 2003
scorpion53061,
Instead of the overhead of a DataTable, I would consider creating one or two
proxy objects, and binding to that. (you still have overhead, but not as
much).

I would define a proxy object that represented a single row of your array
lists

Public Class Item

Public A As Object ' actually properties
Public B As Object

Public Sub New(a As Object, b As Object)
Me.A = a
Me.B = b
End Sub

End Class

Then I would populate an arraylist with the above items.

' VS.NET 2003 syntax
Dim list As New ArrayList(AList.Count)
For index As Integer = 0 to AList.Count - 1
list.Add(New Item(AList(index), BList(index)))
Next

Then I would bind to 'list'.

Instead of using an ArrayList above I would consider creating a class
derived from CollectionBase, that accepted AList & BList as parameters to
the constructor and built the list based on that...

Hope this helps
Jay

"scorpion53061" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I would like a suggestions on the best way to write 2 arraylists to a
> datagrid or if it is even possible.
>
> I would want to do AList.Item(0) = BList.Item(0) and trying to write them
> both to a datagrid in seperate columns.
> i was thinking about writing the arrays to a datatable in code and writing
> that to the grid but I though that would be expensive.
>
>
>



 
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
Sockets and ArrayLists Adrian McNally Microsoft C# .NET 0 13th Nov 2005 02:23 AM
Databinding and ArrayLists Trollpower Microsoft Dot NET Compact Framework 3 6th Jun 2005 06:56 PM
binding ArrayLists to DataGrids-- how to name the columns? Jim Bancroft Microsoft ASP .NET 3 2nd May 2005 09:54 PM
ArrayLists =?Utf-8?B?SGkgSQ==?= Microsoft Dot NET 3 2nd Mar 2004 06:51 PM
ArrayLists question... Bernardo Microsoft C# .NET 6 11th Dec 2003 06:42 PM


Features
 

Advertising
 

Newsgroups
 


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