如何在vb.net中关闭表单 [英] how to close a form in vb.net

查看:85
本文介绍了如何在vb.net中关闭表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        If File.Exists("c:\hi.txt") Then
            Me.Hide()
            successform.Show()
        Else
            Me.Show()
        End If
    End Sub


当hi.txt文件退出successform.show()仅应可见,然后自我形式应关闭.但是即使hi.txt存在,我也得到两种形式.


when hi.txt file exits successform.show() only should visible then self form should close. but i am getting both form even though hi.txt exists

推荐答案

Umapathi K问:
Umapathi K asked:

self表单应关闭

如果进程与程序无关,则无法执行此操作.
试试这个:

This could not be if done if processes are not interrelated to the program.
Try this:

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        If File.Exists("c:\hi.txt") Then
            Me.Hide()
            successform.Show()
        Else
            Me.Show()
            successform.Hide()'You missed this.
        End If
    End Sub



您错过了隐藏成功表单的功能.

--Amit



You missed to hide the successform.

--Amit


这篇关于如何在vb.net中关闭表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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