Link to home
Start Free TrialLog in
Avatar of Sirdots
Sirdots

asked on

How to throw an exception in a class library

I have 2 functions in a class library performing various things. I will make use of this dll in a form by instantiating it and calling the functions. How can I introduce a try catch block in my functions to throw any error that occurs if an error is encountered. I know you throw exceptions in dll's but not sure if I have to use the new keyword.

e.g

public function GetLastName(byval lastname as string)

try
--- body of the code

catch (ex as exception)


End function


Then, How will I handle this in my form calling this function.

Thanks.


ASKER CERTIFIED SOLUTION
Avatar of MajinLoki
MajinLoki

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial