189 8069 5689

vb.net关闭页面 vbs关闭当前窗口

vb.net窗体关闭的问题!

Private Sub frmNotepad_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing

10年积累的成都网站建设、网站制作经验,可以快速应对客户对网站的新想法和需求。提供各种问题对应的解决方案。让选择我们的客户得到更好、更有力的网络服务。我虽然不认识你,你也不认识我。但先网站设计后付款的网站建设流程,更有奉新免费网站建设让你可以放心的选择与我们合作。

Call subexit()

End

End Sub

Sub subexit()

Dim frmNew As frmNotepad

frmNew = ActiveForm

If frmNew.Text = "未定标题 - 记事本" Then

If frmNew.rtb.Text = "" Then

Else

Dim result As New MsgBoxResult 'result提示对话框yes,no,cancel

result = MsgBox("未定标题 文件的文字已经改变。" Chr(10) Chr(10) "想保存文件吗?", MsgBoxStyle.YesNoCancel + MsgBoxStyle.Exclamation, "记事本")

If result = MsgBoxResult.Yes Then 'result.Yes表示保存,清空内容,打开新页面

Dim fileSave As New SaveFileDialog

Dim re As New DialogResult 're提示对话框OK,cancel

fileSave.FileName = "*.txt"

fileSave.Filter = "文本文档(*.txt)|*.txt|所有文件|*.*"

re = fileSave.ShowDialog()

If re = DialogResult.OK Then 're.OK表示成功保存,清空内容,打开新页面

filename = fileSave.FileName

Dim fstream As FileStream

Dim sw As StreamWriter

Try

'frmNew.Text = filename.Substring(filename.LastIndexOf("\") + 1) "- 记事本"

fstream = New FileStream(filename, FileMode.Create, FileAccess.ReadWrite)

sw = New StreamWriter(fstream, System.Text.Encoding.Default)

sw.BaseStream.Seek(0, SeekOrigin.End)

sw.Write(rtb.Text)

sw.Flush()

Catch ex As Exception

MsgBox("保存文件失败")

Finally

sw.Close()

End Try

ElseIf re = DialogResult.Cancel Then 're.cancel表示不保存,不改变任何结果

End If

ElseIf result = MsgBoxResult.No Then 'result.no表示不保存,清空内容

rtb.Text = ""

End If

End If

Else

If rtb.Text.Compare(rtb.Text, compareStr) 0 Then

Dim result As New MsgBoxResult

result = MsgBox(filename + " 文件的文字已经改变。" Chr(10) Chr(10) "想保存文件吗?", MsgBoxStyle.YesNoCancel + MsgBoxStyle.Exclamation, "记事本")

If result = MsgBoxResult.Yes Then

Dim fstream As FileStream

Dim sw As StreamWriter

Try

'frmNew.Text = filename.Substring(filename.LastIndexOf("\") + 1) "- 记事本"

fstream = New FileStream(filename, FileMode.Create, FileAccess.ReadWrite)

sw = New StreamWriter(fstream, System.Text.Encoding.Default)

sw.BaseStream.Seek(0, SeekOrigin.End)

sw.Write(rtb.Text)

sw.Flush()

Catch ex As Exception

MsgBox("保存文件失败")

Finally

sw.Close()

End Try

ElseIf result = MsgBoxResult.No Then

rtb.Text = ""

End If

End If

End If

End Sub

VB.NET是如何关闭窗体

VB.NET关闭当前窗体me.close()

其它窗体用:窗体名.close(),例如:form2.close()

VB.Net 新手问题:如何关闭登录界面并跳到另一个界面

me.dispose()

楼主针对这个问题我也纠结过很久不过就在刚刚我找到了问题所在:

还是用me.close()

打开

项目

最下面一行有一个属性》

应用程序》下面

有一个关机模式

改为:当最后一个窗体关闭时。。。注意

me.close要写在窗体show()后面

例如

写成

f2.show()

me.close()

不要写成

me.close()

f2.show()

ASP.NET怎样用VB.NET代码实现关闭当前页面?

兼容ie和firefox js关闭代码

script language="javascript" type="text/javascript"

function closeWindow() {

window.open('','_parent','');

window.close();

}

/script

a href="javascript:closeWindow();"Close Window/a

好多朋友用到是自动关闭页面代码

script language="javascript"

function closeWindow(){

window.open('','_parent','');

window.close();

}

setTimeout("closeWindow()",3000);

/script


本文题目:vb.net关闭页面 vbs关闭当前窗口
链接分享:http://cdxtjz.com/article/hgdpse.html

其他资讯