Solved

VB.NET Multidimensional Array

Posted on 2013-06-30
2
468 Views
Last Modified: 2013-06-30
I need to create a list or array that would hold the below values.

Item                          Total               Amount
Item 01                        3                     $595
Item 02                        3                     $695

Also, need to know how you would get the values from the array.

Thanks
0
Comment
Question by:CipherIS
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 44

Expert Comment

by:Arthur_Wood
ID: 39288322
I would create a user-defined class (ItemDetail), create instances of that class for each entry, and the create a List of those instances, identified by the Item (Item 01, Item 02, etc.)

AW
0
 
LVL 12

Accepted Solution

by:
funwithdotnet earned 500 total points
ID: 39288326
I think the best way is to create a class that has the properties you want.

You might try something like:
Public Class ItemList

Public Property ItemName as String
Public Property ItemTotal as Integer
Public Property ItemAmount as Decimal

Public Sub New ()
End Sub

Public Sub New (myItemName as String, myItemTotal as Integer, myItemAmount as Decimal)
ItemName = myItemName
ItemTotal  = myItemTotal 
ItemAmount = myItemAmount  
End Sub

End Class

Open in new window


Now you can create a collection to hold your ItemList objects

Dim myCollection as New Collection
Dim tempItemList as ItemList

tempItemList = new ItemList("Item 01", 3, 595.00)            
myCollection.Add(tempItemList,("Item 01")
' repeat as necessary ...
tempItemList = new ItemList("Item 02", 3, 695.00)            
myCollection.Add(tempItemList,("Item 02")

Open in new window


It is easy loop thru the collection or retrieve an ItemList object by key ( i.e."Item 01")

Each ItemList object has the properties you want.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

729 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question