VB.net如何重置一个表格? [英] VB.net how to reset a form?

查看:26
本文介绍了VB.net如何重置一个表格?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否可以重置表单?我正在制作一个战斗游戏,但我需要在战斗后重置表格,这样我才能无限次玩战斗

I wanna know if it's posible to reset a form? I'm making a battle game but i need to reset the form after a battle so i can play the battle infinity times

也许有点像这样:

    If TextBox1.Text = "You Won!" Then
        Me.reset
    End If

当然这行不通,这就是我寻求帮助以重置表单的原因.谢谢!

Of course this dosen't work that is why im asking for help to reset the form. Thanks!

推荐答案

非常简单的解决方案是创建一个新的表单实例并关闭已使用"的实例.项目 + 属性、关机模式设置的大力协助.将其更改为当最后一个表单关闭时".这使此代码工作:

The very simple solution is to just create a new instance of the form and closing the "used" one. Greatly assisted by the Project + Properties, Shutdown mode setting. Change it to "When last form closes". Which makes this code work:

If Me.TextBox1.Text = "You Won!" Then
    Dim frm = New Form1               '' Change the class name if necessary
    frm.Show()
    Me.Close()
End If

这篇关于VB.net如何重置一个表格?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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