无法在UserControl上使用BindingNavigator [英] Cannot use BindingNavigator on a UserControl

查看:66
本文介绍了无法在UserControl上使用BindingNavigator的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我实现了自己的UserControl(子类为fm  UserControl),其中包含一个带有两个TabPages的TabControl.一个标签节目a  datagridview 显示所有记录在a 数据集 桌子.在另一页上,我想拥有a 单一记录视图.我尝试使用BindingNavigator控件进入在用户控件上来自工具箱.

麻烦是那的绑定导航器似乎只工作如果我拖曳它开启a 表格但是如果我将其添加到我的UserControl类中它 不会工作.

不是a 事项的访问权限,我已声明它作为公开的.

我是什么失踪了吗?

谢谢为帮助

 

paolo

解决方案

您的UserControl必须可绑定到BindingSource.简而言之,它需要实现类似于通用DataSource属性的属性.本文介绍了如何实现此目标:

http://www.codeproject.com/KB/database/DataBindCustomControls.aspx

 

我希望这会有所帮助.

此致

Fá bio


Hi everybody,

I implemented my own  UserControl (subclassed fm  UserControl) which  contains a TabControl with two TabPages.   One tab  shows  a  datagridview   showing  all records  in  a  dataset  table. On the other page I would like to have  a  single record  view.  I tried using  a BindingNavigator control  dropping in  on the user control  from the  toolbox.

The trouble  is  that  the  binding  navigator  seems to  only  work  if  I  drag  it  on  a  Form,  but  if  I  add it to my UserControl class   it  won't  work.

It' s not  a  matter  of  access,  I  declared  it  as  public.

What am I  missing?

Thanks  for  helping

 

paolo

解决方案

Your UserControl needs to be bindable to the BindingSource. In short, it needs to implement a property like the common DataSource property. This article explains how you can accomplish that:

http://www.codeproject.com/KB/database/DataBindCustomControls.aspx

 

I hope this helps.

Regards,

Fábio


这篇关于无法在UserControl上使用BindingNavigator的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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