0

I need to define a two dimensional array and assign values. I was wondering if there is an easier way in vb.net to do this other then how I have it below. some of my other arrays have over 700 elements in them.

Dim L1(8, 2) As Double

L1(0, 0) = 0
L1(1, 0) = 6.2170397
L1(2, 0) = 3.055655
L1(3, 0) = 6.10455
L1(4, 0) = 2.83532
L1(5, 0) = 5.8268
L1(6, 0) = 2.5185
L1(7, 0) = 5.48
L1(0, 1) = 3.052
L1(1, 1) = 2.149
L1(2, 1) = 6.12
L1(3, 1) = 0.0
L1(4, 1) = 5.62
L1(5, 1) = 4.57
L1(6, 1) = 3.04
L1(7, 1) = 5.09

3
Contributors
4
Replies
5
Views
4 Years
Discussion Span
Last Post by vasim jada
0

If the elements are stored in a database or Excel workbook, you can just pass it in with a loop.

Where are you getting your data from? (If you can disclose that information)

Edited by Begginnerdev: n/a

0

They are currently in a text file, I could import them into a excel spread sheet.

I was thinking there might be a way to define them like in c++

Double L1[8, 2]  = { 0, 
                 6.2170397,
                 3.055655,
                 6.10455,
                 2.83532,
                 5.8268,
                 2.5185,
                 5.48},
                {3.052,
                 2.149,
                 6.12,
                 0.0,
                 5.62, 
                 4.57,
                 3.04,
                 5.09}

but vb.net does not like that.

Edited by pyTony: fixed formating

0

The easiest way I know of would be to loop through the file and add the values.
If they were comma delimited and in order, you could just loop until you hit end of file.

Edited by Begginnerdev: n/a

This article has been dead for over six months. Start a new discussion instead.
Take the time to help us to help you. Please be thoughtful and detailed and be sure to adhere to our posting rules.