In the interest of full disclosure, I am not a programmer and I'm learning C# on the fly (and don't know much yet). I took over a job in which I must use a custom application coded in C#. Part of my job entails troubleshooting the custom application. (By the way, they knew when they hired me that I didn't know programming).
I've purchased a couple of books and I'll be taking an online C# class starting next week. However, I'm in need of some quick assistance.
I have a try-catch statement in which the catch calls (this might not be the right terminology) a message box that is supposed to display an error message. When I run the code, the error is obviously being caught because the message box displays. However the error does not display. I end up with a blank message box that includes a blank OK button. However, the title bar displays.
The try-catch statement is as follows:
try
{
if (Directory.Exists(dir)==true)
{
files.DeleteFilesInDir(dir,"*.*");
if (Directory.Exists(dir)==true)
files.DeleteFilesInDir(dir+@"040\","*.*");
if (Directory.Exists(dir)==true)
files.DeleteFilesInDir(dir+@"5500\","*.*");
if (Directory.Exists(dir)==true)
files.DeleteFilesInDir(dir+@"2100\","*.*");
if (Directory.Exists(dir)==true)
files.DeleteFilesInDir(dir+@"2604\","*.*");
}
else
Directory.CreateDirectory(dir);
}
catch
{
MessageBox.Show("An error occurred while creating or clearing the installation directory"+"\n"+"Adapt will not be installed.","InstallAdapt.exe");
return;
}
MODE="RUN";
}
I've changed the entire message within the parens to just "hi" thinking that maybe the syntax was incorrect, but I still ended up with an empty message box. The only difference was the message box was smaller. So it recognizes the size of the message.
Any suggestions?