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. iOS 安装Cocoapods以及安装第三方库的操作流程

    安装cocoapods的流程: 1.打开终端,输入:  sudo gem update —system 2.输入密码,稍等 3.gem sources --remove https://rubygem ...

  2. [转]使用EasyRsa3为OpenVPN生成密码

    1. 下载Easy RSA3 下载完并解压后,拷贝一份到/etc/openvpn和/home/client下 #.3版本需要独立下载个easy-rsa,该包用来制作ca证书,服务端证书,客户端证书 w ...

  3. Leetcode Reverse Words in a String

    Given an input string, reverse the string word by word. For example,Given s = "the sky is blue& ...

  4. 【Oracle】ORA-28000: the account is locked-的解决办法

    ORA-28000: the account is locked第一步:使用PL/SQL,登录名为system,数据库名称不变,选择类型的时候把Normal修改为Sysdba;第二步:选择myjob, ...

  5. 关于C#引用Dll后,找不到命名空间的问题

    在引用里明确添加了一个Dll,能够看到该Dll详细信息,可就是用using找不到命名空间.并且发现刚引用时是有该命名空间,一编译就消失了. 最后发现原因如下: 原目标框架为.Net Framework ...

  6. 转 Datatables中文API——基本参数

    鉴于自己一直在使用datatables,发现这是个很不错的表格插件,但是好的东西都是英文的,所以我结合自己的使用经验,把官网的英文api做下简单的翻译,同时也希望大家把自己的使用经验一起分享出来,让我 ...

  7. Servlet处理get请求时的中文乱码问题

    我们都知道,使用Servlet处理get请求时,如果get请求的参数中有中文,直接接收会是乱码,这个时候我们使用类似下面的语句来处理乱码: 12345 String name = request.ge ...

  8. 在Eclipse中使用JSHint检查JavaScript

    之前使用 JSlint 来校验 JavaScript 代码,发现灵活性不够,因此改用 JSHint.按照官方的说法,JSHint 是一个社区驱动(community-driven)的工具,用于检测Ja ...

  9. ID3算法

    转自:http://blog.sina.com.cn/s/blog_6e85bf420100ohma.html 信息熵就是一组数据包含的信息,概率的度量.一组数据越有序信息熵也就越低,极端时如果一组数 ...

  10. Eclipse for Mac 常用快捷键

    为了提高开发效率,Eclipse 为我们提供了许多快捷键,它们能够帮助我们快速和方便的完成一些繁琐的操作.在这里只提供 Eclipse for Mac 的常用快捷键. Command + O:显示大纲 ...