Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6345647
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T20:51:46+00:00 2026-05-24T20:51:46+00:00

I have a collection as such Private Shared ReadOnly thermoPaths As New ReadOnlyCollection(Of String)

  • 0

I have a collection as such

Private Shared ReadOnly thermoPaths As New ReadOnlyCollection(Of String) _
({
   "thermometer_000_108x320.jpg",
   "thermometer_010_108x320.jpg",
   "thermometer_020_108x320.jpg",
   "thermometer_030_108x320.jpg",
   "thermometer_040_108x320.jpg",
   "thermometer_050_108x320.jpg",
   "thermometer_060_108x320.jpg",
   "thermometer_070_108x320.jpg",
   "thermometer_080_108x320.jpg",
   "thermometer_090_108x320.jpg",
   "thermometer_100_108x320.jpg"
})

And wish to link a decimal value between 1 and 100 to the corresponding item in my collection.

So basically what I am trying to achieve is this.

Select Case Decimal.Round(value)
    Case 1 To 9
        Dim x As String = thermoPaths(0)
    Case 10 To 19
        Dim x As String = thermoPaths(1)
    Case 20 To 29
        Dim x As String = thermoPaths(2)
    Case 30 To 39
        Dim x As String = thermoPaths(3)
    case ''AND SO ON
End Select

But I’m sure there must be a “cleaner” way of doing this??

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T20:51:48+00:00Added an answer on May 24, 2026 at 8:51 pm

    Just divide and round up to get the index.

    i = Math.Ceiling(value / 10)
    If value >= 0 AndAlso i < thermoPaths.Count Then
        path = thermoPaths(i)
    Else
        path = Nothing
    End If
    

    Some test points:

    value   i   path
     -1     0   <null> (because value < 0)
      0     0   thermometer_000_108x320.jpg
      1     1   thermometer_010_108x320.jpg
      5     1   thermometer_010_108x320.jpg
     10     1   thermometer_010_108x320.jpg
     49     5   thermometer_050_108x320.jpg
     51     6   thermometer_060_108x320.jpg
     90     9   thermometer_090_108x320.jpg
     91    10   thermometer_100_108x320.jpg
    100    10   thermometer_100_108x320.jpg
    101    11   <null> (because i > 10)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an open source'd website. Some content is private such as connection parameters,
I have a collection like this List<int> {1,15,17,8,3}; how to get a flat string
I have a collection of string. I want to create an image out of
I have a class along the lines of: public class Observation { private String
In my mvvm ViewModel I have such field public int Delta { get; private
Hello guys i have collection : public class ActionData { private int iD; public
I have this class: private static class ClassA{ int id; String name; public ClassA(int
I have Collection List<Car> . How to compare each item from this collection with
I'm planning to have collection of items stored in a TCollection. Each item will
for example I have collection foo of documents like that: {tag_cloud:[{value:games, count:10}, {value:girls, count:500}]}

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.