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).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top