0

hi all,

i want to make error handling but a complete ones. i was done with exception (ex) but i need a little bit more like error line,error number or other. does any one know how to do this?

thx.
best regards.

2
Contributors
2
Replies
4
Views
9 Years
Discussion Span
Last Post by Sawamura
3

you can use err object. this object was built in vb.net.
i will give a simple code for u
try this following code :

sub main()
10:       on error goto errHandling
20:       dim a as integer = 2
30:       dim b as integer = 7
40:       dim c as integer
50:       z = x / y
60:       console.writeline("Value of c : " & c)
70:       exit sub
errHandling:
                 dim ErrMsg as string
                 ErrMsg = "Error Number = " & err.number
                 ErrMsg = chr(13)
                 ErrMsg = "Error Description = " & err.Description
                 ErrMsg = chr(13)
                 ErrMsg = "Erorr Line = " & err.erl
                 msgbox(ErrMsg)
                 resume next
end sub

you can use err.clear to clear every err object property
err.source to show object name or application which error provides.

Ok.
all for the best

Votes + Comments
Perfectly
Thx buddy
not understand :(
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.