|
|||||||
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
#1 |
|
Member (7 bit)
Join Date: Oct 2003
Posts: 83
|
Vb Save Files
It is not a school project but for someone else. How could I use random numbers to bring up certain items in a text file that I already saved.
|
|
|
|
|
|
#2 |
|
Come in Ray...
Join Date: Sep 2004
Posts: 1,668
|
After you have generated a random number, you could use the following to go to that line in the text file. This is in VB6.
Code:
Dim strData As String Dim intCount As Integer intCount = 0 Open "c:\filename.txt" For Input As #1 While Not EOF(1) And intCount <> RandomNumber LineInput #1, strData intCount = intCount + 1 Wend If intCount <> RandomNumber Then Msgbox "End of data reached." Else Msgbox "The data on line " & RandomNumber & " is: " & strData End If |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|