使用
this.radioButton1.DataBindings.Add(new Binding("Checked",dataSet1.Tables[0],"value"));
this.checkBox1.DataBindings.Add(new Binding("Checked", dataSet1.Tables[0], "value"));this.mycm = (CurrencyManager)this.BindingContext[dataSet1.Tables[0]];
或者使用
this.radioButton1.DataBindings.Add(new Binding("Checked",dataSet1,dataSet1.Tables[0].TableName+".value"));
this.checkBox1.DataBindings.Add(new Binding("Checked", dataSet1, dataSet1.Tables[0].TableName+".value"));
this.mycm = (CurrencyManager)this.BindingContext[dataSet1,dataSet1.Tables[0].TableName];绑定在浏览时没有任何问题,但是使用this.mycm.AddNew()之后,并不能完成绑定到新记录上,而且会影响到其他的控件绑定,不知为何?
this.mycm.Count的值在AddNew之后会增加1,但是Position的值却无法达到Count-1
不知道同仁们有没有碰到类似的问题?
this.radioButton1.DataBindings.Add(new Binding("Checked",dataSet1.Tables[0],"value"));
this.checkBox1.DataBindings.Add(new Binding("Checked", dataSet1.Tables[0], "value"));this.mycm = (CurrencyManager)this.BindingContext[dataSet1.Tables[0]];
或者使用
this.radioButton1.DataBindings.Add(new Binding("Checked",dataSet1,dataSet1.Tables[0].TableName+".value"));
this.checkBox1.DataBindings.Add(new Binding("Checked", dataSet1, dataSet1.Tables[0].TableName+".value"));
this.mycm = (CurrencyManager)this.BindingContext[dataSet1,dataSet1.Tables[0].TableName];绑定在浏览时没有任何问题,但是使用this.mycm.AddNew()之后,并不能完成绑定到新记录上,而且会影响到其他的控件绑定,不知为何?
this.mycm.Count的值在AddNew之后会增加1,但是Position的值却无法达到Count-1
不知道同仁们有没有碰到类似的问题?
WinForm程序中的问题
yourDataTable.Columns[yourBinding].DefaultValue = 0;// set a valid value which can be bound to a radiobutton