问题:
I'm trying to pass an object (a reference to the currently logged on user, basically) between two forms.我试图在两个表单之间传递一个对象(基本上是对当前登录用户的引用)。 At the moment, I have something along these lines in the login form:目前,我在登录表单中有一些类似的内容:
private ACTInterface oActInterface;
public void button1_Click(object sender, EventArgs e)
{
oActInterface = new ACTInterface(@"\\actserver\Database\Premier.pad",this.textUser.Text,this.textPass.Text);
if (oActInterface.checkLoggedIn())
{
//user has authed against ACT, so we can carry on
clients oClientForm = new clients(oActInterface);
this.Hide();
oClientForm.Show();
}
else...
on the next form (clients), I have:在下一个表格(客户)中,我有:
public partial class clients : Form
{
private ACTInterface oActInt {get; set;}
public clients(ACTInterface _oActInt)
...which results in me getting: ...这导致我得到:
Error 1 Inconsistent accessibility:
parameter type 'support.ACTInterface' is less accessible than method
'support.clients.clients(support.ACTInterface)'
c:\work\net\backup\support\support\clients.cs 20 16 support
I don't really understand what the problem is - both fields are private, and accessed by the relevant public method from the form.我真的不明白问题是什么 - 这两个字段都是私有的,并且可以通过表单中的相关公共方法访问。 Googling doesn't really help, as it just points towards one element being public and the other private, which isn't the case here.谷歌搜索并没有真正的帮助,因为它只是指出一个元素是公共的,另一个是私有的,这里不是这种情况。
Anybody help?有人帮忙吗?
解决方案:
参考一: https://stackoom.com/question/Q8Zs参考二: Inconsistent Accessibility: Parameter type is less accessible than method