Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7676765
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T17:16:20+00:00 2026-05-31T17:16:20+00:00

Hey all i am trying to understand how to keep my console app open

  • 0

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T17:16:21+00:00Added an answer on May 31, 2026 at 5:16 pm

    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():

    Sub Main()
        Call copyRTDtoWS()
        AddHandler secTimer.Elapsed, AddressOf TimerDone
        secTimer.Enabled = True
    
    
        Console.ReadKey()
    
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

hey all i am trying to make a data output stream in php to
Hey all i am trying to find examples of getting data back from a
Hey all i am trying to turn an A/V reciever on and off this
Hey all. I'm trying to see about handling events in a console application. I
Hey all I am trying to combine my data into one sum. This is
Hey all, I am trying to find out how to copy data from one
Hey all i am trying to figiure out why my code is not triggering
Hey all i am in need of some help trying to figure out how
Hey all, i have been trying for a few minutes on this problem and
Hey all, i have a problem with trying to get 2 forms to close

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.