strtol offers more error handling capability and is safer. atol is easier to use, but is impossible to properly check for errors and exhibits undefined behavior for some erroneous input. The basic difference is that you should use strtol unless your string has already been carefully validated and you're 100% certain that the conversion will succeed with atol.
strtol takes an extra parameter that can be set to what array-element it should convert.
So you could only convert the first 3 chars to a long, or 10 or the middle 5 or ... etc.
atol does not have this functionality.
 And what Narue says is also true, because she's never wrong ;)
>How can I handle the errors in case of strtol() ?
strtol sets errno, it returns suitable values on error, and one of the parameters is a pointer that marks where the conversion stopped. You can mix and match these three error handling schemes to write a bullet-proof conversion.
For Each ctrl As Control In Me.Controls("pnlMainPanel").Controls
If ctrl.GetType Is GetType(System.Windows.Forms.Panel) Then
For Each subCtrl As Control In ctrl.Controls
If subCtrl.GetType Is GetType(System.Windows.Forms.TextBox) Then
If subCtrl.GetType Is ...