这样添加了还是显示不了怎么解决阿?
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { for (int c = 0; c < app.ComponentCount; c++) { IvcComponent comp = app.getComponent(c); for (int i = 0; i < comp.PropertyCount; i++) { string propName = comp.getPropertyName(i); object propValue = comp.getProperty(propName); comboBox1.Items.Add(propName + "::" + propValue); } } }
解决方案
40
这样写
List items = new List<string>();
for (int c = 0; c < app.ComponentCount; c++)
{
IvcComponent comp = app.getComponent(c);
for (int i = 0; i < comp.PropertyCount; i++)
{
string propName = comp.getPropertyName(i);
object propValue = comp.getProperty(propName);
items.Add(propName + “::” + propValue);
}
comboBox1.ItemResource = items;
}
List items = new List<string>();
for (int c = 0; c < app.ComponentCount; c++)
{
IvcComponent comp = app.getComponent(c);
for (int i = 0; i < comp.PropertyCount; i++)
{
string propName = comp.getPropertyName(i);
object propValue = comp.getProperty(propName);
items.Add(propName + “::” + propValue);
}
comboBox1.ItemResource = items;
}