如何以另一种形式进行控制 [英] how to acess Controls in another form

查看:69
本文介绍了如何以另一种形式进行控制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在另一个网页中访问一个网页



我通过将控制修饰符设置为public并继承该类来尝试此操作



AppReports obj = new AppReports();

obj.btnPrint.Visible = false;



但是它显示错误btnprint是null

解决方案

由于这个问题非常受欢迎,而我以前的答案往往没有得到很好的理解,可能不是很清楚,我决定写一篇提示/技巧文章,详细的代码示例和解释:一次回答的许多问题 - Windows窗体或WPF Windows之间的协作



-SA

How to acess control of one web page in another web page

I tried this by setting the control modifier to public and by inheriting the class

AppReports obj = new AppReports();
obj.btnPrint.Visible = false;

but its showing the error btnprint is null

解决方案

As the question turned out to be very popular, and my previous answers often were not well understood, probably were not clear enough, I decided to write a Tips/Trick article complete with detailed code samples and explanations: Many Questions Answered at Once — Collaboration between Windows Forms or WPF Windows.

—SA


这篇关于如何以另一种形式进行控制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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