Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Re. Reading text from a file and using it

Status
Not open for further replies.

DGEN

Programmer
Oct 29, 2004
17
GB
Hi Thank you for your quick reply here is another
piece of code that i used in a previous program this code loads a file for reading and also i found it useful for my card game - why did they have to change vb so much


16: Private Sub cmdFileIn_Click ()
17: ‘ Read the sequential file
18: Dim intCtr As Integer ‘ Loop counter
19: Dim intVal As Integer ‘ Read value
20: Dim intFNum As Integer ‘ File number
21: Dim intMsg As Integer ‘ MsgBox()
22: intFNum = FreeFile
23: Open “Print.txt” For Input As #intFNum
24:
25: For intCtr = 1 To 6
26: Input # intFNum, intVal
27: ‘ Display the results in the Immediate window
28: intMsg = MsgBox(“Retrieved a ” & intVal & “ from Print.txt”)
29: Next intCtr
30:
31: Close # intFNum
32: intMsg = MsgBox(“The Print.txt file is now closed.”)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top