help collections

  • Thread starter Thread starter Lee Lebrada
  • Start date Start date
L

Lee Lebrada

In VB 6 I created a class module w/ 3 attributes that held transaction data,
such as; Trans Name, Amount, Date. I then added all of the transactions
(lines) to a collection, so I ended up with the following collection:

Trans1, Amount1, Date 1
Trans2, Amount2, Date2
Trans3, Amount3, Date 3
Trans4, Amount4, Date4
etc.........

I was then able to loop through the collection and access line and also each
element. My questions is how can I do this in vb.net. Any advice would be
great. Is there a better way?
 
Lee,

For most people active in this newsgroup VB6 is a long time back or they
never used it.

So please tell your problem and not how you did it in VB6, Pascal, Cobol,
FoxPro, Access or whatever.

When you have upgrade problems than there is the special newsgroup.

microsoft.public.dotnet.languages.vb.upgrade

However when you use collections, it is better not to use the
Microsoft.VisualBasic collection, which is the only one with the at one
starting indexer.

There are better ones, but please explain your problem then.

Cor
 
Lee Lebrada said:
In VB 6 I created a class module w/ 3 attributes that held transaction
data,
such as; Trans Name, Amount, Date. I then added all of the transactions
(lines) to a collection,

You can do a similar thing in VB.NET. First, create your class. Then add
objects of that class to an ArrayList:

Dim yourobj As yourclass
Dim MyColl As ArrayList = New ArrayList

MyColl.Add(yourobj)



Then you can iterate through the collection with:



For Each yourobj In MyColl

' do something with yourobj

Next


Tim
..NET pros and cons
http://www.itwriting.com/phorum/list.php?f=6
 
Thanks, Tim. I appreciate your help, unlike the other gentleman you are
willing to help us newbie's.


God Bless you.

Lee
 
Back
Top