Essa Khan Essa Khan - 1 year ago 72
C# Question

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?

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)

if (WaiterAccount == false)

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?

Answer Source

Make your tblLogin class as public

example :

public class tblLogin 

then you will not get this exception

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download