高手请指点一下,DataGridViewComboBoxColumn 选值的问题
下面是我做的邦定,有四个值,如果我要默认选中B的话,如何在加载的时候自动选中B
我知道在ASP.NET里面用FOR 所有的记录如果值相同就选择,应用程序我不知道理解如何做到.
DataTable dt = new DataTable();
dt.Columns.Add(new DataColumn( "BankCode ", typeof(string)));
dt.Columns.Add(new DataColumn( "BankDesc ", typeof(string)));
DataRow dr = dt.NewRow();
dr[0] = "A ";
dr[1] = "中国银行 ";
dt.Rows.Add(dr);
dr = dt.NewRow();
dr[0] = "B ";
dr[1] = "建设银行 ";
dt.Rows.Add(dr);
dr = dt.NewRow();
dr[0] = "C ";
dr[1] = "工商银行 ";
dt.Rows.Add(dr);
dr = dt.NewRow();
dr[0] = "D ";
dr[1] = "交通银行 ";
dt.Rows.Add(dr);
dr = dt.NewRow();
dr[0] = "E ";
dr[1] = "农业银行 ";
dt.Rows.Add(dr);
DataGridViewComboBoxColumn dcbc = new DataGridViewComboBoxColumn();
dcbc.HeaderText = "银行 ";
dataGridView1.Columns.Add(dcbc);
dcbc.DisplayMember = "BankDesc ";
dcbc.ValueMember = "BankCode ";