Question read lines from a text file randomly

aroshlakshan

New member
Joined
Jan 11, 2011
Messages
4
Programming Experience
Beginner
i wanna read lines from a text file randomly until all the lines are read & wanna set a time interval in each two words apart. can anyone please think a piece of code to do that in vb.net?? thanks...!
 
Well considering you can't just read them from the file randomly, you can read the entire contents into a String variable, then use a List(Of String) add all of the lines (Use the variable's Split() method) into the List(Of String) then randomly read each element from the List(Of String).
 
As said above, you could populate a variable and then randomize a number to specify which element to read from the array, if you make sure that you delete the element afterwards and then change the randomize range it will be more efficent and wont have to error check to see if its already read that line? Just a thought!
 

Latest posts

Back
Top