DataSet, BindingSource, BindingNavigator Relationship
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的更多相关文章
- asp.net Hierarchical Data
Introduction A Hierarchical Data is a data that is organized in a tree-like structure and structure ...
- DataSet key points
In a typical multiple-tier implementation, the steps for creating and refreshing a DataSet, and in t ...
- BindingNavigator操作DatagridView的数据
参考 http://wenku.baidu.com/link?url=NWfEfArPZvDO_aI-xEKBHVGoZY9wQO_Oty_GCsGLiPspheCzFYLf_dytuWAqN2_0A ...
- 基于BindingSource的WinForm开发
BindingSource控件介绍 BindingSource控件介绍 BindingSource控件是.NET Framework 2.0提供的新控件之一.BindingSource控件与数据源建立 ...
- C#使用DataSet Datatable更新数据库的三种实现方法
本文以实例形式讲述了使用DataSet Datatable更新数据库的三种实现方法,包括CommandBuilder 方法.DataAdapter 更新数据源以及使用sql语句更新.分享给大家供大家参 ...
- 使用DataSet Datatable 更新数据库的三种方式
1:自动生成命令的条件 CommandBuilder 方法a)动态指定 SelectCommand 属性b)利用 CommandBuilder 对象自动生成 DataAdapter 的 DeleteC ...
- 转载 C# BindingSource
1.引言 BindingSource组件是数据源和控件间的一座桥,同时提供了大量的API和Event供我们使用.使用这些API我们可以将Code与各种具体类型数据源进行解耦:使用这些Event我们可以 ...
- C# 中BindingSource 的用法
.引言 BindingSource组件是数据源和控件间的一座桥,同时提供了大量的API和Event供我们使用.使用这些API我们可以将Code与各种具体类型数据源进行解耦:使用这些Event我们可以洞 ...
- WinForm之中BindingNavigator控件的使用
WinForm之中BindingNavigator控件的使用在微软WinForm中,BindingNavigator控件主要用来绑定数据.可以将一个数据集合与该控件绑定,以进行数据 联动的显示效果.如 ...
随机推荐
- JavaOne_2016演讲视频:
http://list.youku.com/albumlist/show?id=28553407&qq-pf-to=pcqq.group
- Docker使用-v挂载主机目录到容器后出现Permission denied
1. 在挂载主机目录的到容器后,操作挂载的目录出现权限问题: # 将主机上的/data/share/master目录挂载到容器的/opt/share目录docker run -it --name=ma ...
- set+几何 LA 5908 Tracking RFIDs
题目传送门 题意:给一些传感器,范围在r内,再给一些询问点,问这些点能有几个传感器收到,当有墙隔绝时信号减弱,范围变小 分析:set存储传感器,用set的find来查找是否是传感器.因为询问点少,可以 ...
- spring mvc 解决后台传递值乱码问题
在Web-xml 配置添加过滤器 <!-- 配置过滤器 解决乱码问题 --> <filter> <filter-name>CharacterEncodingFilt ...
- 一些有用的HTML5 pattern属性
最近在做手机页面时,遇到数字输入的键盘的问题,之前的做法只是一刀切的使用 type="tel",不过一直觉得九宫格的电话号码键盘上的英文字母太碍事了.于是想要尝试其它的实现方案,最 ...
- [Noi2015]软件包管理器 题解
题目大意: 有n个软件安装包,除第一个以外,其他的要在另一个安装包的基础上安装,且无环,问在安装和卸载某个软件包时,这个操作实际上会改变多少个软件包的安装状态. 思路: 可构成树,用树链剖分,线段树. ...
- BZOJ1082: [SCOI2005]栅栏 题解
题目大意: 有一些木材,可以没有浪费地将一根木材分成几块木板(比如长度为10的木板可以切成长度为8和2的两块木板).现在你希望得到一些长度的木板,问通过分割木材最多能得到几块想要的木板. 思路: 首先 ...
- NOIP欢乐模拟赛 T2 解题报告
小澳的坐标系 (coordinate.cpp/c/pas) [题目描述] 小澳者表也,数学者景也,表动则景随矣. 小澳不喜欢数学,可数学却待小澳如初恋,小澳睡觉的时候也不放过. 小澳的梦境中出现了一个 ...
- 【Oracle】多次提交造成性能慢及处理方法
[问题背景] 2013-08-02 为某地市做了1个脚本用于帮客户账户添加一个新的账本.犯了一个很二的错,存储过程如下(SQL记录用户以后查询),一晚上只执行了190W数据 脚本如下 数据库中总共有5 ...
- reason: '*** Collection <__NSCFArray: 0x7ffa43528f70> was mutated while being enumerated.'
一,错误分析 1.崩溃代码如下: //遍历当前数组,判断是否有相同的元素 for (NSString *str in self.searchHistoryArrM) { if ([str isEqua ...