使用数组类型的对象(实现IList接口)进行绑定的时候,里面的对象必须实现propoty的get方法。
/// <summary>
/// ListBox数据填充
/// </summary>
/// <param name="lstShow">ListBox对象</param>
private void FillListBox(ListBox lstShow)
{
ArrayList arrList = new ArrayList();
string strContent = "a b c d e f g";
string[] sPara = strContent.Split(' ');
foreach (string strItem in sPara)
{
arrList.Add(strItem);
}
// ListBox数据源绑定
lstShow.DataSource = arrList;
}