As per your scenario i have created an example to get you understand how we can pass string collection from one form to another :-
Let say i have two forms as below :-
ContainForm : Holds data which needs to be send.
GettingForm : Form which gets data from ContainForm.
Now we can have property in GettingForm to set the stringcollection before opening the form from first form.
GettingForm.cs
--------------
public partial class GettingForm : Form
{
public StringCollection DummyList { get; set; }
public GettingForm()
{
InitializeComponent();
}
private void GettingForm_Load(object sender, System.EventArgs e)
{
foreach (string str in this.DummyList)
{
MessageBox.Show(str);
}
}
}
ContainForm.cs
---------------
public partial class ContainForm : Form
{
public StringCollection DummyList { get; set; }
public ContainForm()
{
InitializeComponent();
}
private void ContainForm_Load(object sender, System.EventArgs e)
{
DummyList = new StringCollection();
DummyList.Add("Item 1");
DummyList.Add("Item 2");
DummyList.Add("Item 3");
DummyList.Add("Item 4");
}
private void button1_Click(object sender, System.EventArgs e)
{
GettingForm gtForm = new GettingForm();
gtForm.DummyList = this.DummyList;
gtForm.Show();
}
}
Hope this will be of help to you.
There are also more alternatives you can get
here[
^].