I have the main form with a list inside and i need to open another form and edit the list in the main. Generally i'm doing something like ...
public class Form1 : Form
{
List<objectType> obj = new List<objectType>();
private void button_EDIT_BUTTONS_Click(object sender, EventArgs e)
{
EDIT_BUTTONS edit_b = new EDIT_BUTTONS(this);
edit_b.Show();
}
}
public partial class EDIT_BUTTONS : Form
{
Form1 main;
public EDIT_BUTTONS(Form1 mainP)
{
InitializeComponent();
main = mainP;
}
button = main.obj.Find(x => x.ID == object.ID);
............................................................
//modify button
}
My question is to pass the main form like this only to expose the list object or i should Create setters and getters in main form ?