I am really confused and hope somebody will be able to help me with the issue I'm having. I want to use the GET command to obtain a value from a new Form, but my code is overwriting the parameters I pass in the constructor and I am not sure why. Not very familiar with C#.
Here the script I use when I click on a specific button. It is a new Form where I pass into parameters a list of interfaces (the parameters will be modified and I do not want to):
private void btn_t1_Click(object sender, EventArgs e) {
InterfaceT1 Formulaire_T1 = new InterfaceT1(**this.Liste_T1**);
if (Formulaire_T1.ShowDialog() == DialogResult.OK) {
//I WOULD WANT TO USE THE GET COMMAND HERE ONLY IF I CLICK 'OK' ON THE FORM
}
Formulaire_T1.Dispose();
}
Here is the constructor of my Form Formulaire_T1 for reference:
public InterfaceT1(List<T1> Liste_T1) {
InitializeComponent();
this.Liste_T1s = new List<T1>(Liste_T1); //suggested, does not change anything
UpdateView(0);
}
The methods I use in Interface_T1
modify the Liste_T1s
but why it is also changing Liste_T1
in the main function? I do not return any value. It seems those value are now linked? I know it must be a simple thing but can't figure it out.