yes you can. what I have try is add a datagridview, three textbox, one navigatorbar to the form, I set Dataconnecion to sql server by IDE so it generate follow dataset, bindingsource and Tableadapter for me private TestDataSet2 testDataSet2; private System.Windows.Forms.BindingSource tBIDBindingSource; private __11.TestDataSet2TableAdapters.TB_IDTableAdapter tB_IDTableAdapter; I add follow at the form load event this.tB_IDTableAdapter.Fill(this.testDataSet2.TB_ID); this.bindingNavigator1.BindingSource = this.tBIDBindingSource; this.textBox1.DataBindings.Add("Text", this.tBIDBindingSource, "ID", true, DataSourceUpdateMode.OnPropertyChanged); this.textBox2.DataBindings.Add("Text", this.tBIDBindingSource, "Name", true, DataSourceUpdateMode.OnPropertyChanged); this.textBox3.DataBindings.Add("Text", this.tBIDBindingSource, "Cost", true, DataSourceUpdateMode.OnPropertyChanged); then all controls bind to same bindingsource and at last if you want your operation save back to sql server , you need to add this.tB_IDTableAdapter.Update(this.testDataSet2); to where your operation is end
|