user5379214
user5379214

Reputation:

How to solve inconsistent accessibility: parameter type error in this scenario?

public partial class Login : Form
{

    foreach (DataRow rowtab in obtainData.dataSetWithDB.Tables[0].Rows) //Looping through each row 1 by 1
    {
        tblLogin loginDetails = StoreloginDetailsToPassAroundForms(rowtab);
        if (txtDisplay.TextLength == 4 && rowtab["managerAccount"].ToString() == "No" && getInfoFromSelectedCell(DataGridLoginID) == rowtab["userName"].ToString() && txtDisplay.Text == rowtab["userPIN"].ToString())
        {

            MainMenu nextForm = new MainMenu(false, loginDetails); //The issue is with the 'loginDetails' parametre that I am passing to the MainMenu form constructor, how do I solve this?
            nextForm.Show();
        }

    }
    private tblLogin StoreloginDetailsToPassAroundForms(DataRow row)
    {
        tblLogin loginDetails = new tblLogin();

        loginDetails.ManagerAccount = row["managerAccount"].ToString();
        loginDetails.UserName = row["userName"].ToString();
        loginDetails.StaffName = row["staffName"].ToString();
        loginDetails.UserID = Convert.ToInt32(row["userID"]);

        return loginDetails;
    }

}



public partial class MainMenu : Form
{
    public MainMenu(bool WaiterAccount, tblLogin loginDetails)
    {
        InitializeComponent();

        if (WaiterAccount == false)
        {
            btnMenuMang.Hide();
            btnEmployeeMang.Hide();
            btnSystemMang.Hide();
        }

        txtName.Text = loginDetails.StaffName;
    }
}

Please look at the annotation.

This is the error that I get:

Error 1 Inconsistent accessibility: parameter type 'PSObyEssaKhan.tblLogin' is less accessible than method 'PSObyEssaKhan.MainMenu.MainMenu(bool, PSObyEssaKhan.tblLogin)' F:\C# 2016- PROTOTYPE\V21 LOGIN FINISHED\PSObyEssaKhan\PSObyEssaKhan\MainMenu.cs 14 16 PSObyEssaKhan

How do I solve this?

Upvotes: 0

Views: 2089

Answers (1)

Damith
Damith

Reputation: 63065

Make your tblLogin class as public

example :

public class tblLogin 

then you will not get this exception

Upvotes: 2

Related Questions