如何重新启动表单(How do I Restart a Form)

编程入门 行业动态 更新时间:2024-10-24 18:18:14
如何重新启动表单(How do I Restart a Form)

form1上有一个按钮,可以转到form2。 Form2有一个带有鸟形象的图片框。 当单击form2上的图片框时,图片框会消失,而form2会隐藏自己并形成一个图片框。 这是一个更复杂的程序的模型,但具有相同的问题。 第二次返回form1之后,如果我单击将我带到form2的按钮,则不会显示该鸟的图像,因为form2返回到其上一个上一个状态。 我怎样才能使form2刷新/重启/从头再次运行?

任何帮助,将不胜感激。

form1 has a button on it that goes to form2. Form2 has a picturebox with the image of a bird. When the picturebox on form2 is clicked the picturebox disappears and form2 hides itself and form one comes back up. This is a model for a more complicated program but has the same problem. After returning to form1 for the second time if i click the button that brings me to form2 the image of the bird will not show up because form2 returns to its last previous state. What can i do to make form2 refresh / restart / run from the beginning again?

Any help would be appreciated.

最满意答案

你有两个选择。

当你回到form1时完全破坏form2所以下次你去form2它是全新的。

当form2进入视图时,将图像视图设置回可见

更新

干得好。

Dim frm As New Form1 frm.ANewMethod Set frm = Nothing ' Form is destroyed.

这里是文档的链接http://msdn.microsoft.com/en-us/library/aa242139(v=vs.60).aspx

You have two options here.

Destroy form2 completely when you go back to form1 so the next time you go to form2 it's brand new.

When form2 comes into view set the image view back to visible

Update

Here you go.

Dim frm As New Form1 frm.ANewMethod Set frm = Nothing ' Form is destroyed.

And here is a link to the documentation http://msdn.microsoft.com/en-us/library/aa242139(v=vs.60).aspx

更多推荐

本文发布于:2023-07-24 00:27:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1239292.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:表单   重新启动   Form   Restart

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!