SmallDemoDataContext cxt = new SmallDemoDataContext();
BindingSource bs = new BindingSource();
string depId = "";
public FrmBinding()
{
InitializeComponent();
Load();
}
private void Load()
{
bs.DataSource = cxt.Deps;
this.dataGridView1.DataSource = bs;
this.bindingNavigator1.BindingSource = bs;
tbDepid.DataBindings.Add("Text", bs, "depid");
tbDepname.DataBindings.Add("Text", bs, "depname");
tbParents.DataBindings.Add("Text", bs, "parents");
}
private void button1_Click(object sender, EventArgs e)
{
cxt.SubmitChanges();
}
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交