service - How to catch specific Exception in VB.NET -
vb.net 2010, framework 3.5
not catch exception identify type of error is. create error write pc's event log when event log full. sample below throws system.componentmodel.win32exception. that's great , doesn't tell me 'event log full', other errors encompassed system.componentmodel.win32exception. safe @ errorcode = -2147467259 or nativeerrorcode = 1502 determine event log full?
sub main() try while true ' loop overflow event log eventlog.writeentry("source", "message") loop catch w system.componentmodel.win32exception if w.errorcode = -2147467259 ' errorcode = -2147467259 when event log file full? end if if w.nativeerrorcode = 1502 ' nativeerrorcode = 1502 when event log file full? end if if w.message = "the event log file full" ' code event log full end if if w.errorcode = -2147467259 if w.nativeerrorcode = 1502 if w.message = "the event log file full" ' code event log full if 3 conditions true? end if end if end if end try end sub
Comments
Post a Comment