473,386 Members | 1,708 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Console Input Capture in Class Library

Hello world

I have a console application that loads several classes. I would like on of my classes to be able to detect input made in the console and take action based on the input. Sounds simple but of course in my class library I can't see the Console object. Anybody know how to do this

Thanks

Derek
Nov 22 '05 #1
5 1635
> Sounds simple but of course in my class library I can't see the Console
object.

Why not? Should be able to just call Console.Read or ReadLine as normal.
Are you getting some error?

--
William Stacey, MVP
Nov 22 '05 #2
> Sounds simple but of course in my class library I can't see the Console
object.

Why not? Should be able to just call Console.Read or ReadLine as normal.
Are you getting some error?

--
William Stacey, MVP
Nov 22 '05 #3
That is the weirdest part. I don't get an error. In the IDE the
debugger just skips to the end of the function when I call
Console.ReaLine

string line = System.Console.ReadLine(); Exits here
char[] input = line.ToCharArray(); this never executes

No error message thrown. Basically I want to capture input so I can
shut down or pause the app if the user inputs certain characters.


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 22 '05 #4
That is the weirdest part. I don't get an error. In the IDE the
debugger just skips to the end of the function when I call
Console.ReaLine

string line = System.Console.ReadLine(); Exits here
char[] input = line.ToCharArray(); this never executes

No error message thrown. Basically I want to capture input so I can
shut down or pause the app if the user inputs certain characters.


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 22 '05 #5
That is the weirdest part. I don't get an error. In the IDE the
debugger just skips to the end of the function when I call
Console.ReaLine

string line = System.Console.ReadLine(); Exits here
char[] input = line.ToCharArray(); this never executes

No error message thrown. Basically I want to capture input so I can
shut down or pause the app if the user inputs certain characters.


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 22 '05 #6

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

Similar topics

19
by: Dave | last post by:
Hi, I have done some research, trying to Clear The Screen in java code. The first option was the obv: system.out.print("\n\n\n\n\n\n\n\n\n\n\n\n"); then i heard about this method:...
16
by: Chris Maloof | last post by:
Hello, Does anyone know how I can read the ASCII text from a console window (from another application) in WinXP? It doesn't sound like a major operation, but although I can find the window via...
2
by: Hugh McLaughlin | last post by:
Hello everyone and thanks for your help in advance. I am working on an application to track visitors to my website. However, I am confused as to what data to capture for the session, specifically...
4
by: Derek Strickland | last post by:
Hello world I have a console application that loads several classes. I would like on of my classes to be able to detect input made in the console and take action based on the input. Sounds...
1
by: Oz | last post by:
This is long. Bear with me, as I will really go through all the convoluted stuff that shows there is a problem with streams (at least when used to redirect stdout). The basic idea is that my...
6
by: JM | last post by:
Hi, I need a function for a character based program (console) that works exactly like the INKEY$() function in (old) QBasic: Read only 1 keystroke and then move on. Console.Read;...
12
by: Jarod_24 | last post by:
I got a project called "Forms" that hold some forms and stuff in my solution. A argument at startup defines wether to use a From or Console. My plan was to create a myConsole class that would...
10
by: Stephany Young | last post by:
When one uses the System.Diagnostics.Process.Start method to launch a common or garden Console application, one can set the WindowStyle property of the StartInfo object to ProcessWindowStyle.Hidden...
2
by: SriBhargav | last post by:
Hi, I've a question on setting timeout on console.readline() I would like the user to input something through Console.readline() in 5 secs. If there is no input in that time, I would like to...
27
by: CarlosMB | last post by:
Hello, I am writing code that uses a DLL which is supposed to print to console some useful information but for some reason it is not doing so. The environment is a bit complex to explain but...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...

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.