Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27554

VS 2010 Selecting a Random items from a listbox.

$
0
0
I wanted to make a program that enables the user to input text into a listbox and hit a button and it will randomly select one of the text out of however items there are. It will then take the random selected item and put it in another textbox.


I am attempting to use the Randomize() under the form but after a bit of messing around It wont convert string to single so is there a way to do this. If so please comment ASAP.. You guys are so helpful!!

Here are some of the things i tryed
Code:

        Select Case LBRnd.Text
            Case Rnd() = CStr(LBRnd.Text)
        End Select
        TextBox1.Text =

Code:

        Select Case LBRnd.Text
            Case Rnd(LBRnd.SelectedItems)
        End Select
        TextBox1.Text =

I'm not going to lie, in this field of coding. I am weak. I am more intuitive in logic coding.

Viewing all articles
Browse latest Browse all 27554

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>