Hello everyone, I'm trying to develop a program which read from a text file data.
Then display one data line per time with 2 sec delay in an lcd which is connected throught the internet.

I get a run time error'424' here myFile = File.ReadAllLines("c:\account.txt") '//load file.

Dim LineNumber As Integer
   Dim myFile() As String


Private Sub Form_Load()

   tcpComm1.NodeIP = "xxx.xxx.xxx.xxx"
   tcpComm1.NodePort = "xxxx"
   tcpComm1.Link
 


   myFile = File.ReadAllLines("c:\account.txt")  '//load file
   
   LineNumber = 0    'Initialize Line Number

   Timer1.Interval = 2000   '//2 sec delay
   Timer1.Enabled = True
End Sub


Private Sub Timer1_Timer()
   
   If LineNumber < myFile.length Then    '//if not the end of file
      
      tcpComm1.DataOutput (myFile(LineNumber))   ' //display line
      
      LineNumber = LineNumber + 1
   Else
     
     LineNumber = 0  '//Reset lines back to first
   
   End If
End Sub

Thanks
Giannoui

Edited 6 Years Ago by giannoui: n/a

Why don't you rather try the Open File method? -

Dim hFile As Long
Dim Filename As String

Filename = "c:\account.txt"

Open Filename For Binary As #hFile
'Code you need here to do with the file
Close #hFile

There is plenty of help on open file method, use google and find some sample code.

This question has already been answered. Start a new discussion instead.