Why am i getting this exception... System.TypeInitializationException was unhandled Message="The type initializer for 'Client.Form1' threw an exception." Source="Client" TypeName="Client.Form1" StackTrace: at Client.Form1..ctor() at Client.Program.Main() in C:\Documents and Settings\Luis\Desktop\Server\Client\Client\Program.cs:line 21 at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() I added this code to it.... In a different class from the main form i have this: // the try and catch were there already try{....}// see the finally statement for more info catch(....){....}// i just warned that all files in the given file will be deleted //this is the newly added code finally { //path points to a given folder,specify by the Administrator during runtime // foreach(string npath in Dfiles) { File.Delete(npath); } string[] files = Directory.GetFiles(@"C:\Backup", "*.lais"); foreach (string npath in files) { File.Copy(npath, path, true); } //this is the same i have in the try statement Dfiles = Directory.GetFiles(@path,".lais");//just to make sure i have all the files now... if(Dfiles>0){ foreach (string npath in Dfiles) { tempor = File.ReadAllBytes(Dfiles[i]); ms = new MemoryStream(tempor, 0, tempor.Length); crypto = new CryptoStream(ms, Algorythm.CreateDecryptor(), CryptoStreamMode.Read); crypto.Read(tempor, 0, tempor.Length); Images[i] = Image.FromStream(ms); crypto.Close();