.NETGURU
Console.Read()\ReadLine()
Messages   Related Types
This message was discovered on microsoft.public.dotnet.general.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.
Post a new message to this list...

Art
I am working on a console app and I can not find a way to "cancel" a Read or
ReadLine. The scenario is, an employee logs in and the application presents
him/her with a menu of choices they can make and an instruction "Enter a
number 1 - 10 and press [Enter]". The employee walks away from the device
while still logged in. After a period of time I want to log the employee out
and re-prompt for a login. But I can't cancel the read. When the next
employee tries to log in the read is expecting "1 through 10" data.

I have created a reader as its own object and tried to destroy it when the
timer fires but it appears the Read() takes precedence.

Thanks in advance.
Art
--
There are only 10 types of people in the world. Those that understand
binary and those who don't.
Reply to this message...
 
    
Kevin Yu [MSFT] (VIP)
Hi Arthur,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to cancel reading from console
when time outs. If there is any misunderstanding, please feel free to let
me know.

As far as I know, this is not possible. Because Console.Read method
executes synchronously. When Read is called, the program waits for console
to return.

Based on the document, this method will not return until the read operation
is terminated; for example, by the user pressing the enter key. If data is
available, the input stream contains what the user entered, suffixed with
the environment dependent newline character.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Reply to this message...
 
    
Art
Thank you Kevin. I was afraid that was the answer I would get. I'll try to
find a work around.

"Kevin Yu [MSFT]" wrote:

[Original message clipped]

Reply to this message...
 
 
System.Console




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification