I have currently been assigned a project that was implemented couple of years ago in C#. It consists of frames and some excel-files extraction, but the problem is that this project is extremly broken/outdated and I have to change some functionalities and add some new feature.
There are some libraries that are supported only after .NET framework 3.0 that I need to use in the new features,and the framework that the current project was built on is 2.0 or less,so changing the framework raised some thread safety problems.
Between two partial classes for example which are the design file code and the backend code trying to change one label's value raises an error saying that I can not edit something that is being used at the moment... I used delegates for one of the labels, and it worked fine..then the other textbox raised another error.. So is there an option to encapsulate the whole thing and apply thread safety to the whole code without having to follow each line where the error happens?
Edit from comments
Exception:
Exception while Saving Links. Exception: System.InvalidOperationException: Cross-thread operation not valid: Control 'picLinkUBKCross' accessed from a thread other than the thread it was created on.
Code who seams to fail
this.picLinkUBKCross.Image = ((System.Drawing.Image) resources.GetObject("picLinkUBKCross.Image")));
this.picLinkUBKCross.Location = new System.Drawing.Point(367, 57);
this.picLinkUBKCross.Name = "picLinkUBKCross";
this.picLinkUBKCross.Size = new System.Drawing.Size(56, 35);
this.picLinkUBKCross.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.picLinkUBKCross.TabIndex = 14;
this.picLinkUBKCross.TabStop = false;