Solved

vb2005 Get random row from listbox and display in textbox

Posted on 2008-10-03
2
228 Views
Last Modified: 2010-04-21
Hi Experts

iI have a listbox which contains 18 rows of data(1 word per row), I want to randomly choose a row and display it in a textbox.

Hope you can help.
0
Comment
Question by:dizzycat
2 Comments
 
LVL 47

Accepted Solution

by:
Wayne Taylor (webtubbs) earned 250 total points
ID: 22633026
Dim rnd As New Random
TextBox1.Text = ListBox1.Items(rnd.Next(0, ListBox1.Items.Count - 1)).ToString

Wayne
0
 

Author Closing Comment

by:dizzycat
ID: 31502720
Thanks Wayne
This code is exactly what I was looking for.
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question