从另一个表单上的单击按钮中选择选项卡 [英] Select Tab from Click button on another Form

查看:51
本文介绍了从另一个表单上的单击按钮中选择选项卡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有菜单页面表单.它包含两个选项卡TabPage1和TabPage2.当我单击TabPage1中的Button然后打开GridPage另一个表单.然后在GridPage中单击Button之后然后打开TabPage2. div class ="h2_lin">解决方案

问题是良好的实践表明这两种形式是独立的-GridPage不应该了解GridPage2(或您所谓的另一页"之类的东西)或甚至您的MenuPage.如果是这样,则将表单的设计联系在一起,并且在不至少考虑它对另一个的影响的情况下就无法轻易地对其进行更改.但是,有多种方法可以执行此操作,而无需知道任何形式(MenuPage除外).

第一种方法是使用ShowDialog显示GridPage. MenuPage中的执行将停止,直到GridPage关闭-此时您可以从MenuPage中显示GirdPage2.

如果您不希望GridPage关闭,那么第二种方法是在GridPage中创建一个由MenuPage处理的事件.当GridPage发出事件信号时,MenuPage显示GridPage2.

简单!


I have Menu Page Form .It contain two tab TabPage1 and TabPage2.When I click on Button in TabPage1 then Open GridPage Another Form .then after Click Button on GridPage then Open TabPage2.But it is not possible plz help me.

解决方案

The problem is that good practice says that the two forms are independent - the GridPage should not know about GridPage2 (or whatever your "another page" for is called)or even about your MenuPage. If it does, then you tie the design of the forms together and you can''t easily change one without at least considering it''s affect on the other. However, there are ways to do this, without any form (other than the MenuPage) needing to know.

The first way is use ShowDialog to display GridPage. Execution in MenuPage will stop until GridPage closes - at which point you can display GirdPage2 from MenuPage.

If you don''t want GridPage to close, then the second way is to create an event in GridPage which MenuPage handles. When GridPage signals the event, MenuPage displays GridPage2.

Simples!


这篇关于从另一个表单上的单击按钮中选择选项卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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