Break program flow
-
Hi, My application will collect different parameters from user input. Once the "Execute" button is pressed, the parameters will be passed to related methods for exection. I try to figure out how to stop the program flow (not close the application but ask input for missing parameters)if I find some parameters missing (something like Exit() in VB) Can someone please tell me how to do this? Thanks!!:omg:
-
Hi, My application will collect different parameters from user input. Once the "Execute" button is pressed, the parameters will be passed to related methods for exection. I try to figure out how to stop the program flow (not close the application but ask input for missing parameters)if I find some parameters missing (something like Exit() in VB) Can someone please tell me how to do this? Thanks!!:omg:
get the seperatly called messages to throw an exception if a parameter they need is missing, then use the try/catch loop in Execute to catch the exceptions, and do something about it. :)
:suss: Email: theeclypse@hotmail.com URL: http://www.onyeyiri.co.uk
:suss:"All programmers are playwrights and all computers are lousy actors." -
Hi, My application will collect different parameters from user input. Once the "Execute" button is pressed, the parameters will be passed to related methods for exection. I try to figure out how to stop the program flow (not close the application but ask input for missing parameters)if I find some parameters missing (something like Exit() in VB) Can someone please tell me how to do this? Thanks!!:omg:
Application.Exit() ? Paul
-
get the seperatly called messages to throw an exception if a parameter they need is missing, then use the try/catch loop in Execute to catch the exceptions, and do something about it. :)
:suss: Email: theeclypse@hotmail.com URL: http://www.onyeyiri.co.uk
:suss:"All programmers are playwrights and all computers are lousy actors." -
Application.Exit() ? Paul
He said: D Shen wrote: not close the application but ask input for missing parameters ;-PNnamdi told him how to do it. David Stone But Clinton wasn't a predictable, boring, aging, lying, eloquent, maintainer-of-the-status-quo. He was a predictable, boring-but-trying-to-look-hip, aging-and-fat-but-seemingly-oblivious-to-it, lying-but-in-sadly-blatant-ways, not-eloquent-but-trying-to-make-up-for-it-by-talking-even-more, bringer-in-of-scary-and-potentially-dangerous-new-policies. And there was also Al Gore. It just wasn't *right*. Shog9
-
He said: D Shen wrote: not close the application but ask input for missing parameters ;-PNnamdi told him how to do it. David Stone But Clinton wasn't a predictable, boring, aging, lying, eloquent, maintainer-of-the-status-quo. He was a predictable, boring-but-trying-to-look-hip, aging-and-fat-but-seemingly-oblivious-to-it, lying-but-in-sadly-blatant-ways, not-eloquent-but-trying-to-make-up-for-it-by-talking-even-more, bringer-in-of-scary-and-potentially-dangerous-new-policies. And there was also Al Gore. It just wasn't *right*. Shog9
Yeah, misread the question completely. Such is life. I'm getting used to people pointing out stupid things I've said today. I swear I should go back to bed :zzz::zzz::zzz: Paul
-
Thank you. Since I am new to C#, can you please show me how to throw an exception and catch it? Thanks!
there are different types of exceptions in the framework, and you can derive your own, but here is a simple way do throw and catch an exception.
// to thow an exception
throw new Exception("The error text here.");// catch an exception
try
{
// This method throws an exception [as above] if something is wrong
SomeFunction();
}
catch
{
MessageBox("There was an error with your input!");
}hope that helps :)
:suss: Email: theeclypse@hotmail.com URL: http://www.onyeyiri.co.uk
:suss:"All programmers are playwrights and all computers are lousy actors."