Hi im a beginner in vb.net. this is a console application. i would like to know how can i use system.timers.timer so that my application will check the file req.txt every 5 sec. any kind of help will do. here is my application.

Module Module1

Sub Main()
Dim FILE_NAME As String = "C:\Documents and Settings\Cathy\Desktop\req.txt"
Dim reqReader As New System.IO.StreamReader(FILE_NAME)

Dim aryTemp() As String 'array
Dim temp As String
Dim reqNum As String
Dim srcBldg As String
Dim dstBldg As String
Dim usrFneNum As String
Dim testNew As String = 0 ' how to make global? i would like to separate from the rest of the function so that it would no re initialized

Do While reqReader.EndOfStream = False
temp = reqReader.ReadLine()
aryTemp = temp.Split(":")

If testNew < aryTemp(0) Then
testNew = aryTemp(0)

reqNum = aryTemp(0)
srcBldg = aryTemp(1)
dstBldg = aryTemp(2)
usrFneNum = aryTemp(3)

'call validate()
'call algorithm()
Continue Do

End If

Console.WriteLine("Nice " + reqNum + " " + srcBldg + " " + dstBldg + " " + usrFneNum)


End Sub

End Module

I am beginner too and my english is bad, but I try to help you.
I use API function:
Public Declare Sub Sleep Lib "kernel32" Alias "Sleep" (ByVal dwMilliseconds As Long)
do while 1>0 'endless loop
'do something
sleep(1000) 'waits 1000 ms = 1 s

thanks for the help i ported the app to c# my native lanuage, now its all up and running.

This article has been dead for over six months. Start a new discussion instead.