你創建一個類,將代表2列行:如何訪問列表的公共和私有成員<CustomClass>
public class Foo
{
// obviously you find meaningful names of the 2 properties
public string Column1 { get; set; }
public string Column2 { get; set; }
}
,然後你在List<Foo>
存儲:
List<Foo> _items = new List<Foo>();
_items.Add(new Foo { Column1 = "bar", Column2 = "baz" });
哪有我將列表框的數據源設置爲項目?如果我做
ListBox1.DataSource = _items;
我會看到在列表框,而不是它包含
在理論上聽起來不錯,但我可能失去了一些東西。你能發佈你的代碼嗎? –
當然:http://pastebin.com/mqb0QdGi – Novakov
該網站在工作時被阻止。你能複製並粘貼到你的答案嗎? –