日期:2014-05-17 浏览次数:21012 次
namespace NP.Tools
{
public partial class frmFilter : Form
{
public frmFilter()
{
InitializeComponent();
}
private Dictionary<string, string> column=null;
private void frmFilter_Load(object sender, EventArgs e)
{
column = new Dictionary<string, string>();
column.Add("姓名","Name");
column.Add("工号","CodeNo");
column.Add("年龄","Age");
foreach (var item in column)
{
dgv1Field.Items.Add(new MyItem(item.Key,item.Value));
dgv1Field.DisplayMember = "Text";
}
}
}
class MyItem
{
public string Text{get;set;}
public string Value { get; set; }//你需要的值类型
public MyItem(string text,string value)
{
this.Text = text;
this.Value = value;
}
}
}