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 8051683
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T07:21:16+00:00 2026-06-05T07:21:16+00:00

I built a console application with a loop at the end, While(key <> q)

  • 0

I built a console application with a loop at the end,

While(key <> "q")
   'some code
   'code to modify the variable [key]
   Console.Write("A")
End While

in the loop when the user press “q” on the keyboard, the program will go out of the loop,
I’ve tried using Console.Read or Console.ReadKey
which is not working because it waits for the user to press the keyboard,
but I need the loop to keep running although the user is not pressing the keyboard

so in the program the console will be like:
AAAAAAAAAAAAAAAA,etc. until the user press “q” on the keyboard,

any idea?

  • 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-06-05T07:21:19+00:00Added an answer on June 5, 2026 at 7:21 am

    You want to use the Console.KeyAvailable property to check if ReadKey will block. Like this:

    Sub Main()
        Do
            '' Do something
            ''...
            Console.Write("A")
            If Console.KeyAvailable Then
                If Console.ReadKey(True).KeyChar = "q"c then Exit do
            End If
        Loop
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I’m having some difficulties while trying to consume an unmanaged-code dll from my application
I've built a small application which has User Management, a frontend console to enter
I built a console application and built the solution, taking over the API to
I've created a simple console Java application that is built with Maven. Is there
I'm running a .NET remoting application built using .NET 2.0. It is a console
I built a little console application in C# and need to add a windows
My program (a console application) references several other assemblies (many open-source libraries). I built
I've built a .NET console application which worked fine for several years. Since November
Something really weird has happened to my source code. The application always built successfully,
Today we have built a console application for running the scheduled tasks for our

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.