Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cannot catch exception because its not of class system.exception

Status
Not open for further replies.

StuckInTheMiddle

Programmer
Mar 3, 2002
269
US
Hi there,

I'm coding ASP.NET with VB and I've been nicely coding away for a few days getting things working and now that they do i thought it prudent to start putting in some error handling.

Rather then use the old 'on error goto' approach i thought that 'try..catch' was the way to go. However, even trying something simple as follows, i get error 'Cannot catch exception because its not of class system.exception'


try
myvar = mvothervar / someothervar
catch ex as exception when myvar = 0
response.write
end

The 'ex' is underlined, with the above error. I dont get this message when starting a new project, i really dont want to have to cut and paste all my code to a new project. Anyone any ideas about whats gone wrong?
 
Since the error is not that ex is not defined do you have it defined else where as another data type?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top