Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 years ago.
Improve this question
I'm learning C# and it's basically my first coding experience. I've created a Main "Menu" method that goes to other sub methods (some are voids, others bools and ints) with a switch and usage of :
Program Execute = new Program();
Execute.SubMethodName();
Which is working quite well for me, except that i can't exit the sub-method. I have searched over google, stack overflow and the msdn website and every time the answer was to use "return" but i have tried it and it just returns back to the sub-method. How can i exit the sub-methods back to my Main method ?
(Excuse me if i'm not very clear, i'm still learning and i'm very willing to rephrase myself)
All your Exercice functions wait for the user to press ENTER (you call Console.ReadLine()). So to exit, you need to press ENTER on the console screen.
Related
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 5 years ago.
Improve this question
On clicking directly my c# application.exe file, i am running my application and its process in task manager appears if that process on certain condition kills my application stops. What i want is to re run the application after delay of 5 seconds by it self.
You cannot. That process is gone. What you can do is start a second process with you first, most commonly called a "watchdog" or "guard", to scan for your first process and if it does not find it, start it. It's not foolproof though, somebody could just as easily kill that process, too. It's just another layer.
Advice on how to implement that is far to broad for this format, I suggest you read some good articles on it, try to implement it and come here when you find yourself stuck at a specific problem.
Although my answer might not be that helpful, and also this question isn't a kind related to coding issues, but I suppose, using Windows Task Scheduler might work out for you, as you can add various triggers to your application and repeat your task after any set amount of time.
Hope it helps. Thanks
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 years ago.
Improve this question
Screenshot of the problem
Any one seen this before in a C# webbrowser form.
WebBrowser control in WinForms is known for leaking memory. As a solution you can automatically refresh the page from time to time (if that is acceptable for your app) as it frees up consumed resources. Or you can search for alternative workarounds here on StackOverflow, as this problem is well-known and has been thoroughly discussed multiple times.
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
All of UWP Samples I have tried to compile and run do not work. They always freeze on splash screen and stay like that. And after shutting them down, I can't run them again because it says System is using the .exe process.
Have you tried to turn off your Anti-Virus?
In my case, Avast sometimes blocks my executable, so I have to disable it.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 9 years ago.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Improve this question
I'm making a basic calculator on windows forms c#, everything's running the way I need it to, except that I need to know what I can do to show an "error" message on the textbox for the user everytime they press two buttons in a row, instead of having the program crash and not work. Thanks a lot!
You could have a variable in which you hold the last operator was clicked by user and whenever a button is clicked , you check; if it is operator (like + ,- , & ...) and current variable's value is not equal by new one , you update this variable else you could ignore the button clicked.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 8 years ago.
Improve this question
through every step of my very long-code scheduling processing, I write down the result to a richTextBox, with lines that might exceeds thousands of lines, the application falls in the "not responding status", i discovered this problem by chance just when i disable this step. But, i still need a way to get a complete description of my app processing history, do you have any alternative suggestions
my code seems like that:
public void mycode()
{
//code part one
richTextBox1.text += "result is: abc";
//code part two
richTextBox1.text += "result is: efg";
//code part three
richTextBox1.text += "result is: hij";
}
I would suggest you move your long running task to a separate thread. Any other approach will give you pain in the long run. Trying to keep a GUI updated properly and responding to events while running a long task in the GUI thread itself is so error-prone that you're better off not going there.
Read this article here, it's quite clear as a starting point on multithreading in WinForms GUIs: http://msdn.microsoft.com/en-us/library/vstudio/ms171728(v=vs.100).aspx