Can I make my program read from a text file whatever is on a line?Say label1.caption=whatever is on the 1st line, label2.caption=whatever is on the second line and so on?
Printable View
Can I make my program read from a text file whatever is on a line?Say label1.caption=whatever is on the 1st line, label2.caption=whatever is on the second line and so on?
Do a search of the forums.
VB Code:
'use an array of labes: Dim iLine As Integer, strLine As String Open "C:\FILE.txt" For Input As #1 While Not EOF(1) Input #1, strLine lblFileContents(i).Caption = strLine iLine = iLine + 1 Wend Close #1
VB Code:
Dim strLine As String, i% Open strFile For Input As #1 Do i = i + 1 If i = 2 Then Line Input #1, strLine Label1.Caption = strLine Exit Do End If Loop Until EOF(1) Close #1