Click here to Skip to main content
15,923,087 members
Home / Discussions / C#
   

C#

 
GeneralRe: String Search on a Treeview Pin
Alomgir Miah15-Sep-05 17:56
Alomgir Miah15-Sep-05 17:56 
Questioncode complies blows sky high on button OK click Pin
Anonymous15-Sep-05 15:51
Anonymous15-Sep-05 15:51 
AnswerRe: code complies blows sky high on button OK click Pin
Christian Graus15-Sep-05 15:54
protectorChristian Graus15-Sep-05 15:54 
GeneralRe: code complies blows sky high on button OK click Pin
Anonymous15-Sep-05 16:34
Anonymous15-Sep-05 16:34 
GeneralRe: code complies blows sky high on button OK click Pin
Christian Graus15-Sep-05 16:55
protectorChristian Graus15-Sep-05 16:55 
GeneralRe: code complies blows sky high on button OK click Pin
Anonymous15-Sep-05 18:18
Anonymous15-Sep-05 18:18 
GeneralRe: code complies blows sky high on button OK click Pin
Christian Graus18-Sep-05 10:57
protectorChristian Graus18-Sep-05 10:57 
AnswerRe: code complies blows sky high on button OK click Pin
Guffa15-Sep-05 19:18
Guffa15-Sep-05 19:18 
The problem is that you are throwing away all the information about the error. You are catching all possible exceptions and assumes that there is only one possible cause for the error.

If you want to catch the exception that occures when someone writes an illegal number, you should catch only that specific exception (FormatException). Although the better approach is to validate the data instead of using exceptions. Exceptions should only be used for errors that you can't handle, and faulty input is very much possible to handle.

Use the Double.TryParse method to make an attempt to parse the value. If the return value is false, the input is faulty, and you can very gracefully display the error message.

---
b { font-weight: normal; }

Questioncan't get variable into Watch Window? Pin
Anonymous15-Sep-05 14:18
Anonymous15-Sep-05 14:18 
AnswerRe: can't get variable into Watch Window? Pin
Christian Graus15-Sep-05 14:20
protectorChristian Graus15-Sep-05 14:20 
QuestionProblem with database Pin
kavicky15-Sep-05 13:49
kavicky15-Sep-05 13:49 
AnswerRe: Problem with database Pin
Christian Graus15-Sep-05 14:23
protectorChristian Graus15-Sep-05 14:23 
QuestionEvent handlers in multi-threaded apps Pin
brucemo15-Sep-05 13:32
brucemo15-Sep-05 13:32 
AnswerRe: Event handlers in multi-threaded apps Pin
brucemo15-Sep-05 13:57
brucemo15-Sep-05 13:57 
GeneralRe: Event handlers in multi-threaded apps Pin
brucemo15-Sep-05 14:35
brucemo15-Sep-05 14:35 
AnswerRe: Event handlers in multi-threaded apps Pin
Judah Gabriel Himango15-Sep-05 15:27
sponsorJudah Gabriel Himango15-Sep-05 15:27 
AnswerRe: Event handlers in multi-threaded apps Pin
leppie15-Sep-05 16:12
leppie15-Sep-05 16:12 
GeneralRe: Event handlers in multi-threaded apps Pin
brucemo15-Sep-05 17:07
brucemo15-Sep-05 17:07 
GeneralRe: Event handlers in multi-threaded apps Pin
Andy Brummer15-Sep-05 17:38
sitebuilderAndy Brummer15-Sep-05 17:38 
GeneralRe: Event handlers in multi-threaded apps Pin
brucemo15-Sep-05 21:29
brucemo15-Sep-05 21:29 
QuestionA Specific Control Query Pin
udaan15-Sep-05 12:41
udaan15-Sep-05 12:41 
AnswerRe: A Specific Control Query Pin
Guffa15-Sep-05 13:46
Guffa15-Sep-05 13:46 
QuestionRichTextbox to send and receive data Pin
Ralf Hägenläuer15-Sep-05 10:09
Ralf Hägenläuer15-Sep-05 10:09 
QuestionDataSet Select statment Pin
zaboboa15-Sep-05 8:51
zaboboa15-Sep-05 8:51 
AnswerRe: DataSet Select statment Pin
Turtle Hand15-Sep-05 9:21
Turtle Hand15-Sep-05 9:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.