使用BindingSource的,而不是与C#DataGridView.DataSource差异 [英] C# DataGridView.DataSource difference between using BindingSource and not

查看:1105
本文介绍了使用BindingSource的,而不是与C#DataGridView.DataSource差异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现我可以直接设置DataGridView.DataSource到DataTable之间没有,这是所有我迄今所看到的教程都是使用使用的BindingSource。那么究竟是什么thrse二号呢?

I find that I can just set the DataGridView.DataSource directly to the DataTable without using the BindingSource in between, which is what all of the tutorial i seen so far is using. So what is the difference between thrse two?

感谢。

推荐答案

一些信息就使用了的BindingSource如何是改善的直接绑定到一个DataTable的老路上

Some information here on how the use of a BindingSource is an improvement to the old way of binding directly to a DataTable.

http://msdn.microsoft.com/en-us/library/aa480734.aspx

在总结:

BindingSource组件提供$ b $简化
开发人员的工作货币乙管理,变更
通知并能够方便地
获得一个绑定列表的成员。
有,然而,一些其他
鲜为人知改进数据
结合故事值得讨论,并在
事实上,是重要的补充是
补充功能由BindingSource的组件提供

The BindingSource component simplifies the developer's job by providing currency management, change notification and the ability to easily access the members in a bound list. There are, however, some other lesser-known improvements to the data binding story worth discussing, and in fact, are important additions that complement the functionality offered by the BindingSource component.

绑定对象在.NET Framework 2.0中的
能够更好地控制了几个新的
成员在
结合操作。例如,
可以控制数据如何在
绑定控件格式化,当数据源为
更新,以及如何在数据源空和DBNull的
值的处理。
这些新成员,同时也支持
相应添加在
ControlBindingsCollection方法。您可以使用格式和高级
结合在Visual Studio或对话框$ B B $通过代码由
$这些新增乙$ B占据优势。此外,绑定
对象具有用于处理
异常和错误可能发生
。与所述
加入BindingComplete事件的结合过程更好的支持。

The Binding object has several new members in the .NET Framework 2.0 that enable greater control over the binding operation. For example, you can control how data is formatted in a bound control, when the data source is updated, and how null and DBNull values in the data source are handled. These new members are also supported with corresponding Add methods in the ControlBindingsCollection. You can take advantage of these additions by using the Formatting and Advanced Binding dialog box in Visual Studio or through code. In addition, the Binding object has better support for handling exceptions and errors that can occur in the binding process with the addition of the BindingComplete event.

这篇关于使用BindingSource的,而不是与C#DataGridView.DataSource差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆