2 Dim Array in VB.Net

Can someone please provide me some simple code samples for VB.Net on

a) How to create a 2 Dim Array with 3 fields per row
b) Search for item in Array
c) Add Item to Array
d) how could i create a summary for all items which match a certain creteria like where total of 3 value where 1 value = A

i dont use array's often and if only 1 Deim, so i am not even sure if an Array could do all this or if it would be better to go with
a Table. In any case i would like to see some samples and if someone thinks the array is wrong way to go i am willing to listen

thanks


AlexPonnathAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

CJ_SCommented:
If you want to search using criteria you'd better of using a dataset. Read about it and find which features you can or cannot use.
0
RonaldBiemansCommented:
A table or a class would be the way to go here. By the way what do you mean with a 2 Dim Array.
0
RonaldBiemansCommented:
sorry, I meant a table or a collection would be the way to go :-)
0
AlexPonnathAuthor Commented:
Thats all good but does anyone have sample of what a collection would look like which has 2 fields and how to insert, update and find data in the collection.

0
RonaldBiemansCommented:
Hi AlexPonnath,

You mean something like this

        Dim mycol As New Collection

        mycol.Add(New myItem("test1", "test1"), "test1")
        mycol.Add(New myItem("test2", "test2"), "test2")
        mycol.Add(New myItem("test3", "test3"), "test3")
        mycol.Add(New myItem("test3", "test4"), "test4")

        CType(mycol.Item("test2"), myItem).Item2 = "Changed"

        MsgBox(CType(mycol.Item("test2"), myItem).Item2)



Public Class myItem
    Private _Item1 As String
    Private _Item2 As String
    Sub New(ByVal item1 As String, ByVal Item2 As String)
        _Item1 = item1
        _Item2 = Item2
    End Sub
    Public Property Item1() As String
        Get
            Return _Item1
        End Get
        Set(ByVal Value As String)
            _Item1 = Value
        End Set
    End Property

    Public Property Item2() As String
        Get
            Return _Item2
        End Get
        Set(ByVal Value As String)
            _Item2 = Value
        End Set
    End Property
End Class
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.