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.

Recommended Answers

All 2 Replies

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

commented: not understand :( +1
commented: Thx buddy +1
commented: Perfectly +1

hi jx_man
thx for your fast reply, it run goods and helps.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.