【发布时间】:2018-06-16 07:26:28
【问题描述】:
我有一个 UserControl,里面有一个 ComboBox。我需要使用 List 属性填充 ComboBox 项目,但在设计器中出现以下错误:
constructor on type 'system.string' not found
这是我的代码:
public List<string> comboItems
{
get
{
List<string> n = new List<string>();
foreach (var i in comboBox1.Items)
n.Add(i.ToString());
return n;
}
set
{
if (comboItems == null)
comboItems = new List<string>();
foreach (var i in value)
comboBox1.Items.Add(i);
}
}
【问题讨论】:
-
它对我很有效
-
哪一行导致错误?
-
行中没有错误,但是当您尝试通过 Visual Studio 属性窗口设计器将项目添加到列表时,它会显示
constructor on type 'system.string' not found错误
标签: c# .net winforms user-controls windows-forms-designer