vb.net退出提示的简单介绍

vb.net窗体关闭的问题!Private Sub frmNotepad_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
Call subexit()
End
End Sub
Sub subexit()
Dim frmNew As frmNotepad
frmNew = ActiveForm
If frmNew.Text = "未定标题 - 记事本" Then
If frmNew.rtb.Text = "" Then
Else
【vb.net退出提示的简单介绍】Dim result As New MsgBoxResult'result提示对话框yes,no,cancel
result = MsgBox("未定标题 文件的文字已经改变 。"Chr(10)Chr(10)"想保存文件吗?", MsgBoxStyle.YesNoCancelMsgBoxStyle.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.YesNoCancelMsgBoxStyle.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提示代码用提示筐
MsgBox(消息文本vb.net退出提示,显示按纽 , 标题)
例如vb.net退出提示:msgbox("是否退出系统?",vbokcancel vbquestion,"提示")
如何实现VB.NET程序退出时询问是否保存 。把代码写在FormClosing事件中 。
如果不想关闭窗体,则使用e.Cancel = True
VB.NET 2005 点击按钮后,窗口退出了?你把该过程内的代码复制到别的地方先保存 。然后把这个单击过程删除 。重新点击按钮 进入事件,粘贴刚才的代码
vb.net用户登陆界面账号密码自定 , 登陆成功失败都用msgbox显示输入出错三次退出程序,用for next循环语句Dim n As Integer
If n3 then
If TextBox1.Text = "u201116812" And TextBox2.Text = "88888888" Then
MsgBox("登录成功!", 0, "提示信息")
Else
MsgBox("登录失败!", 0, "提示信息")
TextBox1.Focus()
TextBox2.Focus()
n = n1
‘Return
End If
else
MsgBox("3次登录失败!", 0, "提示信息")
Me.Close()
end if
关于vb.net退出提示和的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息 , 记得收藏关注本站 。

    推荐阅读