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. jQuery实现等比例缩放大图片

      在布局页面时,有时会遇到大图片将页面容器“撑破”的情况,尤其是加载外链图片(通常是通过采集的外站的图片).那么本文将为您讲述使用jQuery如何按比例缩放大图片,让大图片自适应页面布局. 通常我们 ...

  2. SpringMVC中向服务器传递时间参数时出现的问题

    1. 问题描述: 今天在SpringMVC应用中上传参数的时候遇到如下问题: The request sent by the client was syntactically incorrect 这说 ...

  3. 如何解决在Ue4编辑器中查看中文注释为乱码的情况

    一般人都会在自己定义的函数后面添加注释,Ue4会在蓝图编辑器中显示这些注释,这是一个相当棒的设定. 但是如果这些注释是中文的话,在蓝图编辑器中就会显示乱码. 如何解决呢? 只需要把你的文件用UTF-8 ...

  4. underscore.js依赖库函数分析一(遍历)

    Underscore简介: underscore是一个非常简洁,实用的javascript库,和jQuery封装类型差不多,但underscore是backbone的依赖 库,想运行backbone就 ...

  5. BZOJ 1475 & 1324 && 建图最小割

    题意: 给一个矩阵,取其中一方格中的数,满足所有所取方格不相邻. SOL: 典型一个二分图,染色后不相邻的连边即可.跑个最大流,裸裸哒. Code: 代码没什么时间写了...并不是很想贴...都是贴板 ...

  6. ORACLE11g JDBC Driver

    http://blog.163.com/z_rx/blog/static/276363762011312947507/ ORACLE服务器端安装程序找到相应目录"x$\app\Adminis ...

  7. ACM: meixiuxiu学图论-并查集-最小生成树-解题报告

    /* 最小生成树,最小环的最大权值按照排序后去构建最小生成树就可以了,注意遇到的第一个根相同的点就记录权值,跳出,生成的环就是最小权值环. */ //AC代码: #include"iostr ...

  8. fiddler 拦截小结

    一,拦截请求或响应常用命令 1.拦截命令 bpu 清除拦截请求 bpu http://www.baidu.com 拦截访问百度网站的请求.可以在 request 框的 WebForms 中改请求内容. ...

  9. TCP/IP基础知识

    TCP/IP基础知识 网络 TCP/IP 引言 本篇属于TCP/IP协议的基础知识,重点介绍了TCP/IP协议簇的内容.作用以及TCP.UDP.IP三种常见网络协议相关的基础知识. 内容 TCP/IP ...

  10. 解决方案:Resharper对系统关键字提示‘can not resolve symbol XXX’,并且显示红色,但是编译没有问题

    环境:Visual studio 2013 community update 4 + Resharper 8.2 + Windows 7现象:我的C#工程编译没有问题, 但是在代码编辑器中系统关键字显 ...