如何解决 可访问性不一致 ?
在form1_load 中调用rc.rcc函数
form1代码:
namespace form_study
{
public partial class Form1 : Form
{
public rc rc1 = new rc();
public ListBox lb = new ListBox();
public Form1()
{
InitializeComponent();
lb = listBox1;
}
public void Form1_Load(object sender, EventArgs e)
{
rc1.rcc();
}
private void listBox1_SelectedIndexChanged_1(object sender, EventArgs e)
{
}
}
}
rc代码:
namespace form_study
{
class rc
{
public Form1 fm = new Form1();
public void rcc()
{
int j = 0;
for (j = 0; j < 99; j++)
{
fm.lb.Items.Add("" + j + "");
fm.lb.TopIndex =fm.lb.Items.Count - 1;
}
}
}
}
调试时报错 :
错误 1 可访问性不一致: 字段类型“form_study.rc”比字段“form_study.Form1.rc1”的可访问性低
怎么解决?