如何将用户控件中的控件绑定到主窗体中的本地数据库 [英] How do I bind controls in a usercontrol to a local database in the main form

查看:64
本文介绍了如何将用户控件中的控件绑定到主窗体中的本地数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在用户控件中遇到问题绑定radgridveiw 

数据集是项目的主要形式,用户控件将被加载到该项目中。

I am having issue binding radgridveiw in a usercontrol 
the dataset is in the main form of the project that the user control will be loaded into.

如何做到这一点。

我尝试将数据库添加到usercontrol 

I tried just adding the database to the usercontrol 

这不起作用??

但对我来说似乎没有任何正确的方式 

But that to me doesnt seem right any ways 

请帮助

推荐答案

也许试试这个:在用户控件中定义一个公共函数,如 SetData 将数据集作为参数并使用它来显示网格。从主表单的
加载事件或其他适当的位置调用此函数。

Maybe try this: define a public function in your User Control like SetData that takes the dataset as parameter and uses it to show the grid. Call this function from Load event of your main form or from other appropriate locations.


这篇关于如何将用户控件中的控件绑定到主窗体中的本地数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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