I am trying to learn passing a list between two C# forms using constructors as shown below. On the first form I did:
List<Cat> myCatList;
//list populating function...
private void btnDisplay_Click(object sender, EventArgs e)
{
df = new DisplayForm(myCatList);
df.Show();
this.Hide();
}
On the next form, I tried to receive the data as shown below:
List<Cat> catList;
public DisplayForm(List<Cat> catList)
{
InitializeComponent();
this.catList = catList;
}
But I always get an error on the second form constructor saying:
Error 1 Inconsistent accessibility: parameter type 'System.Collections.Generic.List<_05_WindowsFormsAppCat.Cat>' is less accessible than method '_05_WindowsFormsAppCat.DisplayForm.DisplayForm(System.Collections.Generic.List<_05_WindowsFormsAppCat.Cat>)'
Any ideas?