I want to create a list of number ranges like: lanes 4-6, 11-13, and 18-20
I want to create a list of number ranges like: lanes 4-6, 11-13, and 18-20.
I am currently saving the list as PointFiveList="4, 5, 6, 11, 12, 13, 18, 19, 20"
I would like to be able to do this no matter how many numbers are entered and as well if the numbers are not consecutive.
You can use the Enumerable.Range(StartInteger, NumberOfValuesInTheRange). For example lest say you wanted a list of integers starting at the number 9 with 5 consecutive values you could do this.
Dim lanes List(Of Integer) = Enumerable.Range(9, 5)
Will result with the list of integers 9, 10, 11, 12, 13.
0
taviafAuthor Commented:
that can help with part maybe but my list is more like 4,5,6,11, 12,13,18,19,20 and then I may have another like 1,2,3,7,8,9,14,15,16
How do you determine what list/range of numbers are to be in the list to be able to create the list programmatically?
0
Veeam Explore for Oracle delivers low RTOs and RPOs with agentless transaction log backup and transaction-level recovery of Oracle databases. You can restore the database to a precise point in time, even to a specific transaction.
Lets say that I have rows 1 - 25 and there are 3 different categories (A, B , C) which are checkboxes. I an trying to group the different checkboxes, below.
c= 10, 17 and 24
b = 4, 5, 6, 11, 12, 13, 18, 19 and 20
a = 7, 8, 9, 14, 15, 16, 21, 22 and 23
I want the data to show like:
b= (4-6), (11-13) and (18-20)
a= (7-9), (14-16) and (21-23)
1) Add numbers to an array
2) Sort the array
3) Loop through the array, first number is the start of the next range, when next number - current number is more than 1 then current number is the end of current range and next number is the start of next range.
When you say you have, "Lets say that I have rows 1 - 25", are these rows in a DataTable object and the DataTable has 3 columns which each of the three columns has a check box and you want to produce the following results depending on which check box has a check mark?
b= (4-6), (11-13) and (18-20)
a= (7-9), (14-16) and (21-23)
If that is the case the use of the first 3 variables a, b, c look like integers but the second group of a, b, c are not integers because they would contain invalid character such as (7 - 9) would not be an integer.
Is my understanding correct or not? If it is not correct can you give a more detail description of what you have to work with, the type of object and initial state, and what you want the end results to look like objects and states.
0
Featured Post
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!
Dim lanes List(Of Integer) = Enumerable.Range(9, 5)
Will result with the list of integers 9, 10, 11, 12, 13.