You are viewing our Forum Archives. To view or take place in current topics click here.
How do I create a Random word generator on VB 2008
Posted:
How do I create a Random word generator on VB 2008Posted:
Status: Offline
Joined: Aug 03, 201212Year Member
Posts: 25
Reputation Power: 1
Status: Offline
Joined: Aug 03, 201212Year Member
Posts: 25
Reputation Power: 1
Hello All,
So I just got Vb 2008 Express Edition again and I was wondering how do I make a program that will generate a certain word or url that I have already pre-loaded.
How do I put 500+ URLS or Words and Have the program generate one word or url each time certain button is clicked?
Thank you
So I just got Vb 2008 Express Edition again and I was wondering how do I make a program that will generate a certain word or url that I have already pre-loaded.
How do I put 500+ URLS or Words and Have the program generate one word or url each time certain button is clicked?
Thank you
#2. Posted:
Status: Offline
Joined: Oct 31, 201014Year Member
Posts: 2,084
Reputation Power: 95
Status: Offline
Joined: Oct 31, 201014Year Member
Posts: 2,084
Reputation Power: 95
You can load the words into an array or something close to that, and have a random number generator generate a number between 0 and the max count of items in the array, and access the array at the index that the generator generated.
Ex:
Ex:
Dim arr() As String = {"F", "Z", "Y"}
Dim RND As New Random
Dim int As Integer = RND.Next(0, arr.Count)
MsgBox(arr(int))
- 1useful
- 0not useful
You are viewing our Forum Archives. To view or take place in current topics click here.