
- Forum
- Programming Talk
- Microsoft .NET
- Making a Array a range
Making a Array a range
This is a discussion on Making a Array a range within the Microsoft .NET forums, part of the Programming Talk category; I am using an the following function in a piece of code MyArr = Array("10","20","30") Yet i would like to ...
-
Making a Array a range
I am using an the following function in a piece of code
MyArr = Array("10","20","30")
Yet i would like to make the values a range, say 10-100 and all inclusive, but it seems very long winded to type each individual number out. Is it possible to just have a "10 to 100"?
Thanks
-
It doesn't allow you do so but that's not limiting you to define your function that would return you an array with a range.
Something like this:
Haven't tried running the above code, but that should give you an idea...Code:Function InitArray(startValue as Integer, endValue as Integer, incrementBy as integer) as Integer() Dim intRange as Integer intRange = ((endVal - startVal)/incrementBy) Dim retArr as Integer(intRange) Dim currentArrValue as Integer = startValue For intIndex as Integer = LBound(retArr) to UBound(retArr) retArr(intIndex) = currentArrValue currentArrValue = currentArrValue + incrementBy Next Return retArr End Function
HTH!!!

Reply With Quote





