Connecting Tech Pros Worldwide Forums | Help | Site Map

error handling - using ex in syntax

Member
 
Join Date: Apr 2007
Posts: 99
#1: Jun 27 '09
Hello,
I am using code with exception handling
C# - have visual studio 2008
code:
try{int mysum=Int.Parse(textbox1.text);}
catch{messagebox.show("mistake" + ex.message);}

intellisense does not recognize ex.- is this syntax not correct syntax?
thank you

tlhintoq's Avatar
Moderator
 
Join Date: Mar 2008
Location: Arizona, USA
Posts: 1,779
#2: Jun 27 '09

re: error handling - using ex in syntax


You haven't defines ex anyplace

catch (Exception ex)
{
// handle exception here
}
Member
 
Join Date: Apr 2007
Posts: 99
#3: Jun 27 '09

re: error handling - using ex in syntax


thank you that works
Reply


Similar C# / C Sharp bytes