如何刷新的BindingSource [英] How to refresh a bindingsource

查看:622
本文介绍了如何刷新的BindingSource的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是真的我发疯,我有一个DataGridView绑定到BindingSource的,上的一个按钮我添加新对象到我的数据库使用我的DataContext的点击,我怎样才能使绑定源以显示新的对象,在我的数据网格?我已经尝试过重新设置绑定源的数据源,但它不会工作,eventhough新的数据源并返回列表中的新对象。

This is really driving me nuts, I have a datagridview bound to a bindingsource, on the click of a button I add new objects to my database using my datacontext, how can I make the binding source to show the new objects in my datagrid? I already tried setting the datasource of the binding source again but it wont work, eventhough the new datasource does return the new objects in the list.

推荐答案

有两种方式,要么你必须重新绑定数据源,或者您应该实现INotifyPropertyChanged接口

There are two ways, either you have to bind the datasource again or you should implement the inotifypropertychanged interface

这篇关于如何刷新的BindingSource的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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