Hi, I'm a VB6 regular programmer and I'm trying to move to .NET. My transition has been soft and easy because of the good habits I learn from people in forum like this one.
Still there is something I don't understand about the Try and Catch thing.
1. How do you know if something (function or method) has something that we can catch? I mean, I can look at the MSDN for everyline I writte, but that wouldn't be very practical. Do all methods and properties have an exception?
2. When or why do you use the "e" as a parameter in a catch? Sometimes I see things like this:
I know the "e" is a value that comes from mostly from events (click, open, load, etc.), but why sometimes you use it in a catch?
3. How often do I need to use the Try Catch? Since in VB6 you don't have this, I RARELY use Try and Catch. Maybe only when I debbug and the compiler says "unhanheld exception".
I hope you could answer my question, since I think this is essential to know.
Cheers everybody.
Still there is something I don't understand about the Try and Catch thing.
1. How do you know if something (function or method) has something that we can catch? I mean, I can look at the MSDN for everyline I writte, but that wouldn't be very practical. Do all methods and properties have an exception?
2. When or why do you use the "e" as a parameter in a catch? Sometimes I see things like this:
C#:
catch (RandomException e)
{
// Code
}
I know the "e" is a value that comes from mostly from events (click, open, load, etc.), but why sometimes you use it in a catch?
3. How often do I need to use the Try Catch? Since in VB6 you don't have this, I RARELY use Try and Catch. Maybe only when I debbug and the compiler says "unhanheld exception".
I hope you could answer my question, since I think this is essential to know.
Cheers everybody.