VB 2008中的多种形式 [英] Multiple forms in vb 2008

查看:55
本文介绍了VB 2008中的多种形式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好


我有多个表单,我需要关闭当前表单-无需单击任何按钮-并直接在此项目中自动打开另一个表单..
我正在使用show和close方法,但是2种形式同时出现或当前形式完全没有出现.

请有人帮我这很紧急(不,不是.)
感谢

HI everybody


I have multiple forms, I need to close the current form -without clicking any button- and directly, automatically another form is opened in this project..
i am using show and close methods but either the 2 forms are appearing together or the current form is not appearing at all .

please somebody help me it is very urgent (No, it''s not.)
thanks

推荐答案

创建一对具有所有适当控件的子控件,而不是使用单独的表单,并根据要求显示/隐藏每个子控件必要时进行控制.

编辑=============

只需将适当的数据库更新代码添加到ShowHide事件处理程序即可.隐藏该窗体后,请它更新数据库.当它显示时,让它从数据库中检索信息(或进行适当初始化控件所需的任何处理.

万一您不知道,表单只不过是控件本身. UserControl就像无边界表单一样(它可以包含其他表单控件,例如文本框,按钮等,甚至其他UserControls.因此,很容易推断出可以将UserControl放置在表单上.
Instead of using separate forms, create a pair of child controls that have all of the appropriate controls on it, and depending on requirements, show/hide each child control when necessary.

EDIT =============

Simply add the appropriate database updating code to the Show or Hide event handlers. When the form is hidden, have it update the database. When it''s show, have it retrieve info from the database (or whatever processing needs to happen to properly initialize the control.

Just in case you didn''t know, a form is nothing more than a control itself. A UserControl is like a borderless form (it can contain other form controls, like text boxes, buttons, etc, or even additional UserControls. It is therefore easy to deduce that you can place the UserControl onto a form.


这篇关于VB 2008中的多种形式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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