Random number
If you need help with a project or need to know how to do something specific in VB.NET then please ask your questions in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
3 posts
Page 1 of 1
Hello I have a listbox full of numbers 1 through to 100 and I need to pick a number at random from there how would I do this and
then apply it to be the text of a button or label :P
I did try
then apply it to be the text of a button or label :P
I did try
Code: Select all
But it did not work :(Dim ram as random
label2.text = ram(1,listbox.items)
Oh, I think I see what you mean ;)
Try this:
Try this:
Code: Select all
Enjoy Dim ram As New Random()
Label2.Text = ListBox1.Items(ram.Next(0,ListBox1.Items.Count))

3 posts
Page 1 of 1
Copyright Information
Copyright © Codenstuff.com 2020 - 2023