Hey guys! I'm making a program requires a listbox with numbers from 0.02-7. That's a lot of numbers to add one at a time. I tried to figure out a different way other than rateListBox.Items.Add("") but I can't really figure it out. Does anyone know now to do that?

One relatively simple way would be with LINQ:

ListBox1.Items.AddRange(Enumerable.Range(2, 699).Select(Function(x) (x / 100).ToString).ToArray)
commented: Thank you so much!! That worked perfectly!! +0

This method would be even simpler. All it does is run a simple FOR loop and you can call it whenever you want to. In the loading screen, you can make it it's own subroutine, however you want.

For mylist As Decimal = 0.02 To 7 Step 0.01
    ListBox1.Items.Add(mylist)
Next
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.