The reason you can't get the parametized version of
WriteErrorLog() to fire is because it's not called anywhere in that code. However, if you look near the bottom of the main form, you'll find:
Code:
finally
{
clsErrorLog myErrLog = newclsErrorLog(err);
myErrLog.PathName = Application.StartupPath;
myErrLog.WriteErrorLog();
txtErrorMsgs.Text = myErrLog.ReadErrorLog();
}
To call the parametized version, change the fifth line to:
myErrLog.WriteErrorLog(err);
Now, because the WriteErrorLog() method has a parameter being passed to it, the compiler knows to call the second version of the method. Single step through it and you will see how it works. The second version allows you more flexibility to pass in to the error log file some other kind of message you might wish to store.