So i have created Windows Form Application and made a library added a reference so that i can use classes from library.
Now i have in a method that is in a class that is in that library it needs to change a pic in PictureBox so how do i get access to a pictureBox that is on form(Form1).
And also it would be nice that the method is able to get in what kind of item he is, for example in picturebox1 or picturebox2 so that it changes the pictureBox that it is called from.
But mainly how to access that pictureBox.
You can’t make the class library refer to the application, as otherwise you’d have a cyclic dependency. It’s hard to say exactly what you should do, but generally speaking class libraries shouldn’t be interested in changing aspects of a user interface directly – that’s normally a more application-specific requirement.
It’s possible that what you really want is an event – the class library would publish an event, and the application would subscribe to it. The class library would then fire the event at the appropriate time, leaving the application code to handle the event by changing the picture.