error handling through delegates..

  • Thread starter Thread starter Ashish
  • Start date Start date
A

Ashish

hi all,
I dont know if this is possible or not, but what i want to do is specify
a delegate for an exception

for example iam trying to create a xml document like

Dim objDoc As New XmlDocument
Dim elem As XmlElement = objDoc.CreateElement("some element")
elem.InnerText = " some < "
objDoc.AppendChild(elem)

this will throw an xml exception, i want to declare a delegate which can
handle this, correct the text, so that the document creation can go on...

may be it is possible through some other idea ..,

any help/pointer will be appreciated
TIA
-ashish
 
No, you can't have a function get called when a specific exception occurrs.

You can put a Try/Catch around your code, catch an xmlexception, and then
call your method from there (though at this point, nothing in the try block
after the line where the exception was thrown would run).
 
Back
Top