调用控件中的表单 [英] Call a Form in Control

查看:69
本文介绍了调用控件中的表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Test1项目中创建了一个控件

而且我还在Test2项目中创建了一个表格.

Test1项目和Test2项目在一个公共项目中

而且我想在控件(Test1项目)中调用表单(Test2项目),所以

我可以在Control

i made a control in Test1 Project

and i also made a form in Test2 project .

Test1 Project and Test2 Project are in one common project

and i want to call form(Test2 Project) in control(Test1 Project) so how

can i call it in Control

推荐答案

中调用它吗?我假设你的意思是:
我有一个解决方案,有两个项目,Test1(包含一个控件)和Test2(包含一个窗体).如何在Test1的控件中显示来自Test的窗体?"

因为如果它们都在同一个项目中,那么您只需编写
I assume you mean:
"I have a solution, with two projects, Test1 (which contains a control) and Test2 (which contains a form). How do I display the form from Test in the control in Test1?"

Because if they are both in the same project then you can just write
FormInTest2 frm = new FormInTest2();
frm.Show();



1)在Test1中添加对Test2的引用(在解决方案资源管理器中,右键单击引用",然后选择添加引用"-跟随那里的对话框)
2)在Test1代码文件的顶部,添加行



1) Add a reference to Test2 in Test1 (In solution explorer, right click "References" and select "Add Reference" - follow the dialogs from there)
2) At the top of the Test1 code file add the line

using Test2;


3)添加代码:


3) Add the code:

FormInTest2 frm = new FormInTest2();
frm.Show();


Bt亲爱的控件是在组件中.而ur ans无法正常工作.
Bt dear the control is in components.and ur ans is not work .


在简单的ur代码中不起作用.
in simple ur code is not work.


这篇关于调用控件中的表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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