按钮单击 [英] Button click

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

问题描述

大家好,

我有一个关于VisualBasic 2008的问题。我做了一个包含一些信息的表格,如果你点击好的,你可以进入登录页面,但是如果单击"确定",则会获得登录页面,但其他表单不会关闭。如何在登录表格时关闭表格。

I had a question about VisualBasic 2008. I made a form with some information and if u click OK you get to a login page, but if you click Ok you get the login page but the other form does not close. How do I make a form close when you go to login form.

我希望你们能阅读并理解这一点因为我的英语不是好的=)

I hope you guys can read and understand this because my englisch is not that good =)

谢谢问候s7d3

推荐答案

您好

您必须考虑应用程序的"关机模式"设置为。

You have to consider your application 'Shut Down Mode' is set to.

如果设置为'启动时'表格关闭然后如果你关闭你的申请表格,申请将关闭(除非你拦截'Form.Closing'事件并重定向到(比如)Form.Hide。

If it is set to 'When Start Up Form Closes' then if you close your application first form, the application will close (unless you intercept the 'Form.Closing' event and redirect to (say) Form.Hide.

你可能会还可以考虑将"关闭模式"设置为"当最后一个表格关闭时"并自己处理最终关闭。

You might also consider setting the 'Shut Down Mode' to 'When last Form closes' and handle the final shut down yourself.

要关闭表单,您将使用< Form> .Close。另一种选择是< Form> .Hide(只是隐藏而不是关闭表单)。

To close a Form, you would use <Form>.Close. An alternative would be <Form>.Hide (which simply Hides rather than Closes the Form).

' Form1 and Form2
Option Strict On
Option Explicit On
Public Class Form1
  Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

    ' This Form is start up form

    ' Create a new Form2
    Dim nf2 As New Form2
    ' Show the new form
    nf2.Show()

    ' close this form
    ' if ShutDownMode is set to
    ' WhenStartUpFormCloses then
    ' this will end application and
    ' the Form2 will never be seen.

    ' if ShutDownMode is set to
    ' WhenLastFormCloses then
    ' the application will continue
    ' until the last form is
    ' explicitly Closed.
    Me.Close()
  End Sub
End Class


EDIT :ShutDownMode可以通过以下方式设置:Solution Explorer(双击MyProject)。应用标签。关闭模式。

EDIT: ShutDownMode can be set via: Solution Explorer (double click on MyProject). Application Tab. ShutDown Mode.


这篇关于按钮单击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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