Reading in the contents of a text file
Hi All, im trying to readin the last line of a file and put it in a label in eVB 3.0: heres what ive tried so far, ive basically played around with the code from my VB6 app, but it dosent seem to like LOF:
VB Code:
Dim strText, arLines() As String, N As Integer
File1.Open "/My Documents/Business/invoice.txt", fsModeAppend
'read entire file into string variable
strText = Input(LOF(1), File1)
'split entire text on [Carriage Return]+[Line Feed] characters
'and populate string array
arLines = Split(strText, vbNewLine)
File1.Close
For N = UBound(arLines) To LBound(arLines) Step -1
If Not arLines(N) = vbNullString Then
Product_Choice.label5.Caption = arLines(N)
Product_Choice.label5.Caption = Product_Choice.label5.Caption + 1
File1.Open "/My Documents/Business/invoice.txt", fsModeAppend
File1.LinePrint Product_Choice.label5.Caption
File1.Close
Exit For
End If
Next N
anyone any ideas, im a bit new to eVB so excuse anything glaringly obvious!!!