|
-
Apr 17th, 2000, 07:46 PM
#2
Addicted Member
How about opening the file and reading the entire contents into a string? Now if you are using VB6 you can use the Split function to seperate the string on the Newline characters (vbCrLf) and place all of your quotes into elements of an array. If you're not using VB6 then you'll have to write a function that uses InStr and Mid to parse the string the same way. After you have all your quotes in an array you can use the Randomize and Rnd calls to randomaly generate a number based on the UBound of the array. You can then use that number to retrieve the random quote form the array.
Lost? If you want me to elaborate with some code just post a reply specifying which version of VB you are using.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|