I am aware that the title is not self-explanatory but this is the simplest one that I came up with.
Basically, I am have a .NET DLL and a .NET forms application. In this form, I load this DLL and create a class let’s say:
MyClass a = new MyClass();
I have:
public string DataBridge
{
get { return String.Empty; }
set { txtHistory.Text += value + "\r\n"; }
}
in my form and I want to access this DateBridge string within MyClass which is located inside my .NET DLL.
I am not sure if it’s clear, let me know if there is a point that you didn’t understand.
Your .NET Forms application must have a reference to the .NET dll. If you’re programming with Visual Studio, you can simply right-click on the project in the Solution Explorer, then choose “Add Reference”, and find the DLL that contains MyClass.
Since you can have multiple projects open in one Solution, you can choose to add a reference to your MyClass project rather than the DLL file, this will make sure that changes in your MyClass automatically will be visible in your .NET Forms project.
If you don’t use Visual Studio, but some other tool (eg. SharpDevelop), please see that tool’s documentation to find out how to add a reference tho another project or dll.
If you don’t use a tool at all, but use the CSC.exe compiler to compile you code, see the compiler’s documentation to find out how to include a reference to an external dll at compile time.