That's where the problem is. You are trying to use a FileInfo object as an array which you can't. Here is what you probably want to do:
vb Code:
'FORM level variables Dim myCounter As Integer = 0 Dim myFiles() As String Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) _ Handles MyBase.Load Try myFiles = IO.Directory.GetFiles("C:\GARA\", "*.txt") Catch ex As Exception MessageBox.Show(ex.Message) End Try End Sub Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick Try If myCounter <= myFiles.Length - 1 Then My.Computer.FileSystem.MoveFile(myFiles(myCounter), "C:\GARA1\" & IO.Path.GetFileName(myFiles(myCounter))) myCounter += 1 End If Catch ex As Exception MessageBox.Show(ex.Message) End Try End Sub




Reply With Quote