我试图在两个表单之间传递一个对象(基本上是对当前登录用户的引用).目前,我在登录表单中有这些内容:
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...
Run Code Online (Sandbox Code Playgroud)
在下一个表格(客户)上,我有:
public partial class clients : Form
{
private ACTInterface oActInt {get; set;}
public clients(ACTInterface _oActInt)
Run Code Online (Sandbox Code Playgroud)
...导致我得到:
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
Run Code Online (Sandbox Code Playgroud)
我真的不明白问题是什么 - 两个字段都是私有的,并且可以通过表单中的相关公共方法访问.谷歌搜索并没有真正帮助,因为它只是指向一个元素是公共的而另一个是私有的,这不是这里的情况.
有人帮忙吗?