ELJ
ELJ

Reputation: 1

Passing an Object between Forms in C#

I've created an Object Array of Students and I want to pass in from one form to another. When I try to do so I get"

Inconsistent accessibility: parameter type 'College_Life.Student[]' is less accessible than method 'College_Life.frmStudentOutput.frmStudentOutput(College_Life.Student[])

The 1st FORM looks like this :

namespace College_Life
{
    public partial class frmInput : Form
    {
        private int intCount;
        private Student[] ALevel = new Student[1];
.
.
.
        private void cmdSort_Click(object sender, EventArgs e)
        {
            //
            frmStudentOutput OutputForm = new frmStudentOutput(ALevel);
            OutputForm.Show();
        }

. . . The 2nd Form looks like

    private Student[] ALStudent;

    public frmStudentOutput(Student[] ALStudent)
    {
        InitializeComponent();

Hope you can help Thanks

Upvotes: 0

Views: 1311

Answers (1)

nein.
nein.

Reputation: 2127

Open the Student class and check if it is public.

It should look like this:

public class Student
{
    public Student()
    {
         //...
    }
    //...
}

Upvotes: 1

Related Questions