473,626 Members | 3,298 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to pause for keystroke...

In a console based application, I'd like to pause for a
keystroke. I thought Console.Read would do the trick, but
after it didn't I found this on the MSDN description of
the function:

Console.Read
This method will not return until the read operation is
terminated; for example, by the user pressing the enter
key.

I'd like the program to continue, no matter what key they
press. Thank you in advance.
Nov 16 '05 #1
5 4792
Just delegate the console reading to another thread.

- Sahil Malik
http://codebetter.com/blogs/sahil.malik/
"Aaron" <aa***@digitald elay.net> wrote in message
news:10******** *************** *****@phx.gbl.. .
In a console based application, I'd like to pause for a
keystroke. I thought Console.Read would do the trick, but
after it didn't I found this on the MSDN description of
the function:

Console.Read
This method will not return until the read operation is
terminated; for example, by the user pressing the enter
key.

I'd like the program to continue, no matter what key they
press. Thank you in advance.

Nov 16 '05 #2
Hey,

I haven't gotten that far in my C# book lol. But I do
understand the concept. I have O'Reilly's Programming C#
by Jesse Liberty. Although the book is rather good, there
are a few things I don't like about it. She spends a lot
of time on certain subjects that I find are easy to
understand and not enough time on other subjects that are
little more involved. The most annoying aspects are some
of the example applications with show of the new features
she's explaining without any real example of real-world
application. Another annoying tidbit is that the chapter
on IO is one of the very last.

You recommend any other books? I find one book on a
programming language is never enough. ;)
-----Original Message-----
Just delegate the console reading to another thread.

- Sahil Malik
http://codebetter.com/blogs/sahil.malik/
"Aaron" <aa***@digitald elay.net> wrote in message
news:10******* *************** ******@phx.gbl. ..
In a console based application, I'd like to pause for a
keystroke. I thought Console.Read would do the trick, but after it didn't I found this on the MSDN description of
the function:

Console.Read
This method will not return until the read operation is
terminated; for example, by the user pressing the enter
key.

I'd like the program to continue, no matter what key they press. Thank you in advance.

.

Nov 16 '05 #3
Hi Aaron,

I would recommend Professional C# from Wrox.

PS: Jesse Liberty is a 'he' :)

HTH,
Rakesh Rajan

"Aaron" wrote:
Hey,

I haven't gotten that far in my C# book lol. But I do
understand the concept. I have O'Reilly's Programming C#
by Jesse Liberty. Although the book is rather good, there
are a few things I don't like about it. She spends a lot
of time on certain subjects that I find are easy to
understand and not enough time on other subjects that are
little more involved. The most annoying aspects are some
of the example applications with show of the new features
she's explaining without any real example of real-world
application. Another annoying tidbit is that the chapter
on IO is one of the very last.

You recommend any other books? I find one book on a
programming language is never enough. ;)
-----Original Message-----
Just delegate the console reading to another thread.

- Sahil Malik
http://codebetter.com/blogs/sahil.malik/
"Aaron" <aa***@digitald elay.net> wrote in message
news:10******* *************** ******@phx.gbl. ..
In a console based application, I'd like to pause for a
keystroke. I thought Console.Read would do the trick, but after it didn't I found this on the MSDN description of
the function:

Console.Read
This method will not return until the read operation is
terminated; for example, by the user pressing the enter
key.

I'd like the program to continue, no matter what key they press. Thank you in advance.

.

Nov 16 '05 #4
Rakesh,

A 'he'? The 'Programming C#' book provides no clue as to
his gender. I do actually have a 'Teach Yourself C++ in 21
Days' book that he wrote; and upon reviewing the back
cover, I see that he is a 'he.' ;) Never really noticed.
Thanks!

I just finished reading the chapter on Delegates and
Events. Although I do like the book and overall the
explainations are thorough and easy to understand, the
book is sometimes very aggrivating. There are many cases
where he talks about syntax and certain aspects of how to
accomplish something using excerpts from a source which he
reveals serveral pages later. The issue, many of these
excerts are incorrect and don't match the source he later
uses; many instances where he fails to put colons or
parenthesis after a function, etc.

Thanks for the book recommendation; I'll definitely check
it out.
-----Original Message-----
Hi Aaron,

I would recommend Professional C# from Wrox.

PS: Jesse Liberty is a 'he' :)

HTH,
Rakesh Rajan

"Aaron" wrote:
Hey,

I haven't gotten that far in my C# book lol. But I do
understand the concept. I have O'Reilly's Programming C# by Jesse Liberty. Although the book is rather good, there are a few things I don't like about it. She spends a lot of time on certain subjects that I find are easy to
understand and not enough time on other subjects that are little more involved. The most annoying aspects are some of the example applications with show of the new features she's explaining without any real example of real-world
application. Another annoying tidbit is that the chapter on IO is one of the very last.

You recommend any other books? I find one book on a
programming language is never enough. ;)
>-----Original Message-----
>Just delegate the console reading to another thread.
>
>- Sahil Malik
>http://codebetter.com/blogs/sahil.malik/
>
>
>"Aaron" <aa***@digitald elay.net> wrote in message
>news:10******* *************** ******@phx.gbl. ..
>> In a console based application, I'd like to pause for a >> keystroke. I thought Console.Read would do the trick,
but
>> after it didn't I found this on the MSDN description

of >> the function:
>>
>> Console.Read
>> This method will not return until the read operation is >> terminated; for example, by the user pressing the enter >> key.
>>
>> I'd like the program to continue, no matter what key

they
>> press. Thank you in advance.
>
>
>.
>

.

Nov 16 '05 #5
Yeah Jesse Liberty is a "he" ; bet he's pissed off when you call him a
"She".

Besides that - you are gonna have to read up about System.Threadin g
namespace - it ain't that tough - but I don't know any books off the top of
my head. Google for a sample.
--

- Sahil Malik
http://codebetter.com/blogs/sahil.malik/


"Aaron" <aa***@digitald elay.net> wrote in message
news:10******** *************** *****@phx.gbl.. .
Hey,

I haven't gotten that far in my C# book lol. But I do
understand the concept. I have O'Reilly's Programming C#
by Jesse Liberty. Although the book is rather good, there
are a few things I don't like about it. She spends a lot
of time on certain subjects that I find are easy to
understand and not enough time on other subjects that are
little more involved. The most annoying aspects are some
of the example applications with show of the new features
she's explaining without any real example of real-world
application. Another annoying tidbit is that the chapter
on IO is one of the very last.

You recommend any other books? I find one book on a
programming language is never enough. ;)
-----Original Message-----
Just delegate the console reading to another thread.

- Sahil Malik
http://codebetter.com/blogs/sahil.malik/
"Aaron" <aa***@digitald elay.net> wrote in message
news:10****** *************** *******@phx.gbl ...
In a console based application, I'd like to pause for a
keystroke. I thought Console.Read would do the trick, but after it didn't I found this on the MSDN description of
the function:

Console.Read
This method will not return until the read operation is
terminated; for example, by the user pressing the enter
key.

I'd like the program to continue, no matter what key they press. Thank you in advance.

.

Nov 16 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2705
by: Ste | last post by:
Hello, my goal would be implementing some keystroke analysis using php. I'm a novice in php, so i ask your advice: according to you, is it possible to log each keystroke client-side even if php is a server-side language, or shall i use JavaScript and make the client run the program locally? And, if i can use php to do that, how can i implement a feature logging keystrokes on the client system? Thanks,
7
6219
by: hokieghal99 | last post by:
Does anyone know of a keystroke logger that has been written in Python for Windows machines? I'd like to see such a script and use it as a point of reference for a real-time backup project that I'm working on. Basically, I'd like to be able to capture all keystrokes from the keyboard buffer and write them to a text file so I could reporduce emails, documents, etc. in the event of file loss that occurs between nightly backups. For example,...
2
3234
by: Wayne Wengert | last post by:
I want to get the decimal (integer) value of user keystrokes. I am using the following code. chrInput is the character entered (e.g. "M") and "keystroke is DIMed as Short keystroke = Microsoft.VisualBasic.Val(chrInput) but it always yields a value of 0 How should I be doing this?
1
1912
by: Amin Gunawan via .NET 247 | last post by:
I would like to put a combo box in a column of a datagrid. I've seen the samples in the MSDN library of other sources, butall samples didn't catch the 'DOWN/UP' keystroke. It means thatwhen I select an item in the combo box, I need to use my mousefor the selection. If I use the 'DOWN/UP' keystroke, the cell inthe grid move to the next or prev row in the grid. Anybody knows how to catch the down/up keystroke when selectingitems in the combo...
15
5738
by: Frank Bormann | last post by:
Hi, probably a stupid question, but I haven't been able to find anything. Is there a istream related function that let me read exactly one keystroke from the keyboard through cin? What I need it to do is this: - remove all characters currently in the input buffer - block until the user presses a key
11
39876
by: Paminu | last post by:
Is there something like system("PAUSE") for linux?
8
36442
by: Wim | last post by:
My GUI application starts a process (a console program) when the user hits Play. I would like to add an option to pause that process. The code I've added to detect if the user hit pause/unpause seems to work. But I have no clue how to pause/suspend the process. As far as I can see the Process class doesn't offer anything for this. So it's probably the thread the process is running on that should be suspended or put to sleep. But just...
3
1456
by: GG | last post by:
I have a console app that when it is run and I press a key then it freezes till a press another key gain. Is there a way to avoid it that is the keystrokes do not pause the app? Thanks *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it!
0
1347
by: jorgetheawesome | last post by:
Hi! I was writing a program, and for debugging, used the system("pause") command. I am running Windows XP. Its an MS-DOS app, programmed in Dev-C++. But the program, when compiled, runs differently each time, without recompiling and without changing the code. Also, system pause sometimes exits the program and sometimes runs(the differences are whether it runs normally or exits). I did get a system error-Mis called Windows function- from the...
0
8269
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8711
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
7203
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6125
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5576
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4094
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4206
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2630
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1515
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.