Stop application throwing and exception

paulbacca

New member
Joined
Jan 25, 2008
Messages
4
Programming Experience
Beginner
I've developed and windows form application. It has a number of dropdown menus which select a length of time like 00:30:00 (30mins). When a time period is chosen and the start button clicked it works fine.

However, if someone forgets to select the time period then the application throws the exceptions below:

An unhandled exception of type 'System.FormatException' occurred in mscorlib.dll

Additional information: Input string was not in a correct format.

How can I prevent this from happening. I put a messagebox in to inform the user that it was not selected but the application still closes. I think there must be a very simple way of getting the program not to treat this as an error? Can you please help.

I have made a work around that sets the timer to a value if it is blank. But this sets the timer going.

Thanks

Paul
 
"dropdown menus" you mean combobox? You can set a default selected item.
If not, you can disable submit button until a selection is made.
 
>"dropdown menus" you mean combobox? You can set a default selected item.
>If not, you can disable submit button until a selection is made.

I had solved the problem by setting the selected item to a default one. However, disabling the start button is a stroke of genius and so simple.Doh! I've still have a long way to go...

Thanks
 
Back
Top