error handling - using ex in syntax

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • buddyr
    New Member
    • Apr 2007
    • 105

    error handling - using ex in syntax

    Hello,
    I am using code with exception handling
    C# - have visual studio 2008
    code:
    try{int mysum=Int.Parse (textbox1.text) ;}
    catch{messagebo x.show("mistake " + ex.message);}

    intellisense does not recognize ex.- is this syntax not correct syntax?
    thank you
  • tlhintoq
    Recognized Expert Specialist
    • Mar 2008
    • 3532

    #2
    You haven't defines ex anyplace

    catch (Exception ex)
    {
    // handle exception here
    }

    Comment

    • buddyr
      New Member
      • Apr 2007
      • 105

      #3
      thank you that works

      Comment

      Working...