You can get the list of words into an array by
Dim words() As String = Replace(My.Computer.FileSystem.ReadAllText(filename), vbLf, "").Split(vbCr)
To generate a random index for words you can call
Private Function Random(ByVal lo, ByVal hi)
'returns a random integer in the range [lo,hi]
Random = lo + CInt(Rnd() * (hi - lo))
End Function
Just pass it lo=0 and hi=ubound(words). Make sure you call Randomize() when the form loads to avoid generating the same string of random numbers each run.
Reverend Jim
Posting Shark
1,169 posts since Aug 2010
Reputation Points: 253
Solved Threads: 159