如果你直接绑定DataTable表,如下面代码:listBox1.DataSource = dt;则会出现下图现象:正确做法见代码:using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms
要使用Dictionary集合,需要导入C#泛型命名空间 System.Collections.Generic(程序集:mscorlib) Dictionary的描述1、从一组键(Key)到一组值(Value)的映射,每一个添加项都是由一个值及其相关连的键组成2、任何键都必须是唯一的3、键不能为空引用null(VB中的Nothing),若值为引用类型,则可以为空值4、Key和Value可以是任何类型(string,int,custom class 等)