致电主项目表格 [英] Call Main Project form

查看:52
本文介绍了致电主项目表格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将一个名为Project2的现有项目添加到我已运行的Project1中......我还将Project2的引用添加到Project1。我想从Project2运行Project1表单...请帮助...



如果我想从Project1运行Project2表单。我知道的那种方法

进口项目2

以及我可以运行的任何形式的Project2 ......



但是我想从我最近添加的Project2运行Project1 Form ..

请帮助....

I have added one existing project named Project2 into my already running Project1... I have also add reference of Project2 to Project1. I want run Project1 form from Project2... Please help...

If I want to run Project2 form from Project1. That method I know
Imports project2
and any form of Project2 I can run...

But I want to run Project1 Form from Project2 which I have recently added..
Please help....

推荐答案

它完全一样进程 - 假设您没有最终创建循环创建周期,其中P1.Form创建P2.Form,创建P1.Form,其中......



以与P1对P2相同的方式指定表单:

It's exactly the same process - provided that you don't end up with a circular creation cycle where P1.Form creates P2.Form which creates P1.Form, which ...

Just specify the form in the same way you did for P2 from P1:
Dim f as new Project2.Form1()
f.Show()









我只想关闭Project2.CancelOrder.Form并运行Project1.Welcome.Form ....只有这么多......你能告诉我怎样才能做下面的陈述......

如果Project.Order.Form关闭,那么Project1.Welcome.Form可能会运行.. ....我可以打电话给Pr来自Project1的oject2表单......但不是Project2中的Projec1表单....请帮助..




啊!这是一个不同的场景。



我假设您从Project1和Welcome表单开始,然后以某种方式打开Project 2中的CancelOrder表单从欢迎表单(或Project2中打开CancelOrder表单的表单 - 它相同的东西)。

当CancelOrder表单关闭时,您想返回欢迎表单。 />


具体如何做到这一点取决于你的工作方式,但总的来说:

1)有一个单独的表格作为申请打开。这可能是欢迎表格。

2)从这里,你打开CancelOrder表格(可能隐藏欢迎表格)。

3)当CancelOrder关闭时,你重新显示欢迎表格。



有几种方法可以做到这一点:

1)使用ShowDialog:





"I just want to close Project2.CancelOrder.Form and Run Project1.Welcome.Form.... Only this much... Can You tell me how can I do the following statement...
If Project.Order.Form is close then Project1.Welcome.Form may Run...... I can call Project2 Forms from Project1... but Not Projec1 Forms from Project2.... please help.."


Ah! That's a different scenario.

I'm assuming that you start off with Project1 and the Welcome form, and that in some way you then open the CancelOrder form in Project 2 from the Welcome form (or a form in Project2 which opens the CancelOrder form - it amounts to the same thing).
When the CancelOrder form closes, you want to go back to the Welcome form.

Exactly how you do this depends on how you do things, but in general:
1) Have a single form which is opened as the Application. This is probably the Welcome form.
2) From this, you open the CancelOrder form (and probably, hide the Welcome form).
3) When CancelOrder closes, you re-display the Welcome form.

There are a couple of ways to do this:
1) Use ShowDialog:

Project2.CancelOrder co = new Project2.CancelOrder();
Hide();
co.ShowDialog();
Show();

这会隐藏Welcome表单而不关闭它,并在CancelOrder表单关闭后再次显示它 - 在关闭之前没有其他任何事情发生。



2)使用Show:

This hides the Welcome form without closing it, and makes it visible again once the CancelOrder form has closed - nothing else happens until it has closed.

2) Use Show:

Project2.CancelOrder co = new Project2.CancelOrder();
co.FormClosing += new FormClosingEventHandler(CancelOrder_FormClosing);
Hide();
co.Show();



在事件处理程序中,如果需要,可以访问信息,并在当前表单上使用Show重新显示它。



Project2中的表格在任何时候都不需要知道Project1中是否存在表格


In the event handler, you access the info if you need to, and use Show on the current form to re-display it.

At no time should forms in Project2 need to know about the existence of forms in Project1


这篇关于致电主项目表格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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