Hey all i am trying to understand how to keep my console app open even after it gathers data and sends it off. I am converting a GUI to the console app. It has a timer that fires the sub every 20 seconds. But it doesnt seem like it works in the console app since after it fires off the sub it closes the app without waiting.
Dim secTimer As New System.Timers.Timer(20000)
Sub Main()
Call copyRTDtoWS()
AddHandler secTimer.Elapsed, AddressOf TimerDone
secTimer.Enabled = True
End Sub
Public Sub copyRTDtoWS()
Dim connectionString As String = GetConnectionString()
Dim dataReader As SqlDataReader = Nothing
etc etc...
Call resetTimer()
End Sub
Private Sub resetTimer()
secTimer.Stop()
secTimer.Start()
End Sub
Public Sub TimerDone(ByVal sender As Object, ByVal e As System.Timers.ElapsedEventArgs)
secTimer.Stop()
Call copyRTDtoWS()
End Sub
What all do i need to do in order for it to act like the GUI version did?
Thanks for your time,
David
As DharaPPatel already wrote in his comment, console.readkey() makes the console application wait for a keystroke. Put it at the end of your Sub Main():