|
DataGrid 綁定了數據集,文本框也綁定了相同的數據集,但在DataGrid移動時,
文本框的數據為什麼不跟著DataGrid的數據變動?
同志們,說一下我該怎麼綁定啊....
private void BindText()
{
//this.txtBH .DataBindings.Add ("Text",this.bsEmployee1,"employee.bh");
this.txtBH.DataBindings.Add(new Binding("TEXT",bsEmployee1 ,"employee.bh"));
this.txtBM .DataBindings.Add ("Text",this.bsEmployee1,"employee.bm");
this.txtJIANZHAO.DataBindings.Add ("Text",this.bsEmployee1,"employee.jianzhao");
this.txtPHOTO.DataBindings.Add ("Text",this.bsEmployee1,"employee.photo");
this.txtXM.DataBindings.Add ("Text",this.bsEmployee1,"employee.xm");
this.txtZW.DataBindings.Add ("Text",this.bsEmployee1,"employee.zw");
this.dtpBDR.DataBindings.Add ("Text",this.bsEmployee1,"employee.bdr");
}
private void frm_Main_Load(object sender, System.EventArgs e)
{
this.EmpSqlcmd.Fill(this.bsEmployee1.employee);
BindText();
SetDataComponentState(true);
}
上面這代碼,還有哪個地方要加一點什麼啊....
|
|