• 关闭form前提示是否保存


    在form的formclosing事件中加上判断:

    Private Sub frmSequenceEditor_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
            If MessageBox.Show("The file has changed!would you like to save?", "Save file", MessageBoxButtons.YesNoCancel) = Windows.Forms.DialogResult.Yes Then '提示是否保存
                dlgSaveFile.InitialDirectory = Application.StartupPath
                dlgSaveFile.OverwritePrompt = True
                dlgSaveFile.Filter = "BurnIN Files(*.DUT)|*.DUT|All Files(*.*)|*.*"
             
                If (dlgSaveFile.ShowDialog(Me) = System.Windows.Forms.DialogResult.OK) Then
                    Dim FileName As String = dlgSaveFile.FileName
                    ' TODO: Add code here to save the current contents of the form to a file.
                    Dim str As String = ConfigDataXml(dgvSequence)
                    DutData.SaveDutFile(FileName, str)
                    MessageBox.Show("Save To Dut success! The file path is " + FileName)
                    'end
                End If
            Else

            End If
        End Sub

  • 相关阅读:
    CSS处理小技巧
    React 脚手架构建
    Tomcat8学习
    javaScript(ES5中的类,原型,原型对象和函数对象的关系)
    保留两位小数(逢5进位,精度不会丢失)
    获取过去12个月
    mybatis 踩坑记录
    动态代理--jdk和cglib
    lambda表达式
    mybatis的mapper映射配置文件详解
  • 原文地址:https://www.cnblogs.com/huige1004/p/1339697.html
Copyright © 2020-2023  润新知