Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
Hello I have a console application and every time the user types something and enters it closes it and I dont really want that in my application since it needs multiple inputs. I've tried debugging and opening the file itself.
Is there a answer?
-HoverNot
A console application closes when it runs out of code to execute
You can halt until someone has pressed enter by asking for input:
Console.ReadLine()
If you want to force the program to keep waiting for input, you can use
while(true) {
Console.ReadLine()
}
Then the window won't close until you press ctrl-c or click the cross (or kill the process some other way)
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
I'm writing a c# console application and I want it to monitor all keyboard input, even when other programs have focus, so that if a person hits a specific key combination (from anywhere), my code will be activated.
Currently when I run my program and then select another program, my program does not do anything when I enter the key combination.
A thread might be a good idea.
Sorry for my grammar and English. I try to explain it good.
Console application is not suitable for that. you should be looking for Keyboard Hook.
Have a look at this question.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I have an application developed in C # that sometimes is blocked, when it is blocked I have to restart it. I know if there is any way to detect if the application is frozen, close it and then restart.
Thank for all!
Since it could be a third party programm you want to restart:
You restart a process in C# like so:
Process[] procs;
procs = Process.GetProcessesByName("Name");
// Test to see if the process is not responding.
if (!procs[0].Responding)
{
procs[0].CloseMainWindow();
procs[0].WaitForExit();
procs[0].Start();
}
Otherwise please follow the hints provided in the comments.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I want just 3 users can be simultaneous Run my software.
My Software is written in c#.
Any idea, how to do the same?
Write in log-file all starts and exits (user, start date, exit date). When program start - check starts count and exits count. Maybe you should define old starts without exit as with exit (connection error and program can't write to log about her exit etc.).
3 Users on Network , Users copy short cut from exe file from network on desktop and then run
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I would like to make a console application in which if a certain user types "volume up" and presses the ENTER key then the system volume to go up.
Any ideas?
For creating a console application in c#:
How to: Create a C# Console Application
To read the input text from a console application: Console.ReadLine Method
To set the system volume programmatically: Paedow's question and answer
Having these links your job is quite easy now. :)
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
Maybe it’s a novice question, but I a am a novice. I have a program which does a lengthy task, while it does it, the form stays frozen, if its minimized it can't be maximized Etc. How can I fix that.
Also, the program runs in a loop, and in each iteration prints info to a list box, line by line. Problem is, the list box doesn't get written, untill after the whole loop finishes. How can I correct that.
You can use either a Thread or a BackgroundWorker to do your work.
Calling lengthy code from the UI will block the UI thread and the app 'freezes'.