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()
Else
Continue Do

End If

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

Loop


'Console.WriteLine(reqReader.ReadToEnd.ToString)
'reqReader.Close()
'reqReader.Peek()
Console.ReadLine()
End Sub

End Module

Hi,
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
loop

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.