Question

I made a Windows Forms Application with Visual Studio. For some reason, I can not edit the content of a label with a .dll. In the .exe file, I can edit the text with label1.Text="Something";, but in the dll label1.Text="Something"; doesn't work. I think tried using the namespace and class to change it, but that didn't work either. (I am not sure I tried this, but I think I did.) How am I supposed to change something in a Forms application with a .dll?

Was it helpful?

Solution

You should pass a reference to your Dll's class with the Form's instance which should be changed, but this is a bad practice.

It's better to use per example an event in your Dll class or call a function of your Dll from the Form and change the text there.

It's always better to separate UI from data classes.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top