Multiple Bindings caused dataBing weird????

Text.DataBindings.Add(new Binding("Text", bs1, "Index_Code"));

Text.DataBindings.Add(new Binding("Text", bs2, "Index_Code"));

        BindingSource bs = new BindingSource();
DataTable table = new DataTable(); table.Columns.Add("Name", typeof(string));
table.Columns.Add("Value", typeof(int)); table.Rows.Add("A", );
table.Rows.Add("B", ); //comboBox1.DataSource = table;
//comboBox1.DisplayMember = "Name";
//comboBox1.ValueMember = "Value";
////comboBox1.DataBindings.Add();
//comboBox1.SelectedIndex = -1; bs = new BindingSource();
bs.DataSource = table;
bindingNavigator1.BindingSource = bs; textBox1.DataBindings.Add(new Binding("Text", bs, "Name"));
private void bindingNavigatorAddNewItem_Click(object sender, EventArgs e)
{ DataRowView row = (DataRowView)bs.Current; row["Name"] = "C";
row["Value"] = ; //row.IsNew is true; int i = table.Rows.Count; // = 2
bs.EndEdit(); //commit to datatable => dataSource get updated
i = table.Rows.Count; // = 3 if (row.IsNew) //false
{
MessageBox.Show("new row");
}
}

DataSet, BindingSource, BindingNavigator Relationship的更多相关文章

  1. asp.net Hierarchical Data

    Introduction A Hierarchical Data is a data that is organized in a tree-like structure and structure ...

  2. DataSet key points

    In a typical multiple-tier implementation, the steps for creating and refreshing a DataSet, and in t ...

  3. BindingNavigator操作DatagridView的数据

    参考 http://wenku.baidu.com/link?url=NWfEfArPZvDO_aI-xEKBHVGoZY9wQO_Oty_GCsGLiPspheCzFYLf_dytuWAqN2_0A ...

  4. 基于BindingSource的WinForm开发

    BindingSource控件介绍 BindingSource控件介绍 BindingSource控件是.NET Framework 2.0提供的新控件之一.BindingSource控件与数据源建立 ...

  5. C#使用DataSet Datatable更新数据库的三种实现方法

    本文以实例形式讲述了使用DataSet Datatable更新数据库的三种实现方法,包括CommandBuilder 方法.DataAdapter 更新数据源以及使用sql语句更新.分享给大家供大家参 ...

  6. 使用DataSet Datatable 更新数据库的三种方式

    1:自动生成命令的条件 CommandBuilder 方法a)动态指定 SelectCommand 属性b)利用 CommandBuilder 对象自动生成 DataAdapter 的 DeleteC ...

  7. 转载 C# BindingSource

    1.引言 BindingSource组件是数据源和控件间的一座桥,同时提供了大量的API和Event供我们使用.使用这些API我们可以将Code与各种具体类型数据源进行解耦:使用这些Event我们可以 ...

  8. C# 中BindingSource 的用法

    .引言 BindingSource组件是数据源和控件间的一座桥,同时提供了大量的API和Event供我们使用.使用这些API我们可以将Code与各种具体类型数据源进行解耦:使用这些Event我们可以洞 ...

  9. WinForm之中BindingNavigator控件的使用

    WinForm之中BindingNavigator控件的使用在微软WinForm中,BindingNavigator控件主要用来绑定数据.可以将一个数据集合与该控件绑定,以进行数据 联动的显示效果.如 ...

随机推荐

  1. hdu 5269 ZYB loves Xor I

    Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission( ...

  2. 转:Docker学习---挂载本地目录

    原文: http://my.oschina.net/piorcn/blog/324202 docker可以支持把一个宿主机上的目录挂载到镜像里 docker run -it -v /home/dock ...

  3. JavaScript 笔记 ( Prototype )

    这阵子实在好忙 ( 这样说好像也不是一两个月了... ),然后因为工作伙伴都是 JavaScript 神之等级的工程师,从中也学到不少知识,毕竟就是要和强者工作才会成长呀!为了想好好瞭解他们写的程式码 ...

  4. Tomcat 配置 Context

    在 conf/Catalina/localhost/ 下添加 xml配置文件,文件名和站点名一致. 配置文件示例 <?xml version='1.0' encoding='utf-8'?> ...

  5. 转载:Java面试笔试题大汇总

    本文来源于:http://blog.csdn.net/wulianghuan 1.面向对象的特征有哪些方面 1).抽象: 抽象就是忽略一个主题中与当前目标无关的那些方面,以便更充分地注意与当前目标有关 ...

  6. ural 1346. Intervals of Monotonicity

    1346. Intervals of Monotonicity Time limit: 1.0 secondMemory limit: 64 MB It’s well known that a dom ...

  7. Java classpath 如何自动添加web-content /lib下的jar包

    右键属性--Java build path--Libraries--add library--Web app libraries -- next --next -- ok

  8. 【BZOJ1257】【CQOI2007】余数之和sum

    Description 给出正整数n和k,计算j(n, k)=k mod 1 + k mod 2 + k mod 3 + … + k mod n的值,其中k mod i表示k除以i的余数.例如j(5, ...

  9. InterBase数据库迁移到MySQL(恢复备份)

    我拿到的是InterBase导出的“.gbk”后缀的数据库备份文件,目标是可以通过命令行的方式导入到指定的数据库中,在这个脚本中我使用了InterBase数据库中自带的“gbak”命令行来进行操作. ...

  10. FPGA技术的发展历史和动向

    本文关键字:fpga技术,fpga发展, fpga培训,FPGA应用开发入门与典型实例 一.FPGA技术的发展历史 纵观数字集成电路的发展历史,经历了从电子管.晶体管.小规模集成电路到大规模以及超大规 ...