我想知道为什么我可以从主类外部的组合框中访问文本。但我无法向其中添加项目..我的组合框的修饰符设置为 public
public class ImageManager : mainFrame // Where my components are located
{
public ImageManager()
{
}
public void getText()
{
Console.WriteLine(comboBox.Text); //Will perfectly retrieve the text from it
}
public void setItem()
{
comboBox.Items.Add("Items"); //Does absolutely nothing and doesn't show error
}
}
感谢帮助 !