Click here to Skip to main content
15,916,042 members
Home / Discussions / C#
   

C#

 
GeneralRe: Opening a binary document from db is failing Pin
seeism21-Jul-10 23:14
seeism21-Jul-10 23:14 
Question.exe update Pin
padmanabhan N20-Jul-10 18:49
padmanabhan N20-Jul-10 18:49 
AnswerRe: .exe update Pin
Abhinav S20-Jul-10 19:13
Abhinav S20-Jul-10 19:13 
AnswerRe: .exe update Pin
Nagy Vilmos20-Jul-10 19:17
professionalNagy Vilmos20-Jul-10 19:17 
GeneralRe: .exe update Pin
padmanabhan N20-Jul-10 21:13
padmanabhan N20-Jul-10 21:13 
QuestionDataColumn question Pin
Richard Blythe20-Jul-10 14:23
Richard Blythe20-Jul-10 14:23 
AnswerRe: DataColumn question Pin
Dan Mos20-Jul-10 15:22
Dan Mos20-Jul-10 15:22 
QuestionHandling Multiple Exception Types Pin
Matt U.20-Jul-10 13:31
Matt U.20-Jul-10 13:31 
Hi everyone. My question is quite simple. I would like to know how exactly you would handle multiple types of exceptions in a method. Is this correct:

try
{
// File operation...
// Form operation...
// Other operation that throws exception...
}
catch (FileNotFoundException fnf)
{
// Do something...
}
catch (ArgumentNullException ane)
{
// Do something...
}
catch (SomeException se)
{
// Do something...
}


I know it works. However, is that the best way to do it? I am asking because the exceptions that are thrown by different file operations, such as File.Open, are quite different from the types thrown by MessageBox.Show, for example. Or should I perform file operations and catch exceptions then perform other operations and catch their exceptions and so on?

Thanks in advance!
AnswerRe: Handling Multiple Exception Types Pin
Richard Blythe20-Jul-10 14:13
Richard Blythe20-Jul-10 14:13 
GeneralRe: Handling Multiple Exception Types Pin
Matt U.20-Jul-10 14:18
Matt U.20-Jul-10 14:18 
AnswerRe: Handling Multiple Exception Types Pin
Luc Pattyn20-Jul-10 14:17
sitebuilderLuc Pattyn20-Jul-10 14:17 
GeneralRe: Handling Multiple Exception Types Pin
Matt U.20-Jul-10 14:23
Matt U.20-Jul-10 14:23 
GeneralRe: Handling Multiple Exception Types Pin
Richard Blythe20-Jul-10 14:30
Richard Blythe20-Jul-10 14:30 
GeneralRe: Handling Multiple Exception Types Pin
Luc Pattyn20-Jul-10 15:07
sitebuilderLuc Pattyn20-Jul-10 15:07 
GeneralRe: Handling Multiple Exception Types Pin
Matt U.20-Jul-10 15:14
Matt U.20-Jul-10 15:14 
AnswerRe: Handling Multiple Exception Types Pin
PIEBALDconsult20-Jul-10 15:40
mvePIEBALDconsult20-Jul-10 15:40 
AnswerRe: Handling Multiple Exception Types Pin
Ravi Bhavnani20-Jul-10 17:50
professionalRavi Bhavnani20-Jul-10 17:50 
QuestionOldie (as opposed to a newbie) trying to write a Windows Service Pin
jbradshaw20-Jul-10 4:38
jbradshaw20-Jul-10 4:38 
AnswerRe: Oldie (as opposed to a newbie) trying to write a Windows Service Pin
Pete O'Hanlon20-Jul-10 7:38
mvePete O'Hanlon20-Jul-10 7:38 
AnswerRe: Oldie (as opposed to a newbie) trying to write a Windows Service Pin
PIEBALDconsult20-Jul-10 16:49
mvePIEBALDconsult20-Jul-10 16:49 
QuestionHow to convert word document to xsl/xslt [modified] Pin
Exelioindia20-Jul-10 3:05
Exelioindia20-Jul-10 3:05 
AnswerRe: How to convert word document to xsl/xslt Pin
PIEBALDconsult20-Jul-10 3:10
mvePIEBALDconsult20-Jul-10 3:10 
GeneralRe: How to convert word document to xsl/xslt Pin
Exelioindia20-Jul-10 3:24
Exelioindia20-Jul-10 3:24 
GeneralRe: How to convert word document to xsl/xslt Pin
PIEBALDconsult20-Jul-10 3:40
mvePIEBALDconsult20-Jul-10 3:40 
GeneralRe: How to convert word document to xsl/xslt Pin
Exelioindia20-Jul-10 3:51
Exelioindia20-Jul-10 3:51 

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.