How do i randomly select an item from a listbox and make it appear in text1.
Last edited by Ricky1; Oct 21st, 2005 at 12:55 PM.
Im Learning !!!!
Text1.Text = List1.List(Int((List1.Listcount) * Rnd)) I think that's correct but I haven't tested it.
Tips, Examples & Tutorials: A valuable forum tool • Generate unique TreeView keys • TreeView with "open" and "closed folder" icons • Time code using GetTickCount • How to trap the Tab key • Scroll a form • NumberBox ActiveX control • Color a ListView row • An InputBox form • How to use SaveSetting and GetSetting • A program registration scheme • Spellcheck a Textbox • Resize controls • Open Windows Explorer at Last Visited Path • A Blackjack Game • Count lines of code • Private Message Viewer • Copy/Paste VB Code • Paste VB Code Add-In • Insert Procedure Names Add-In • A calculator for the game of Spider • My review of REALbasic 2008 • VB6 Debug Tutorial • Picture/Video Viewer • VBF Photo Contest Winners 2009 - 2016
worked great thank you.
You're welcome. Don't forget to use Randomize or you'll get the same results each time you run the program.
hmmm its not very random tho. Because everytime i load the program its always the samething that appears first.
I assume you missed my previous post
how do i use Randomize ?
VB Code: Private Sub Form_Load() Randomize End Sub
Private Sub Form_Load() Randomize End Sub
sorted thanks alot.
Forum Rules