zoukankan      html  css  js  c++  java
  • 关闭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

  • 相关阅读:
    构建之法阅读笔记一
    第一冲刺阶段 工作总结 02
    第一冲刺阶段 工作总结 01
    学习进度条 第七周
    团队计划会议 01
    团队博客 一 需求分析
    学习进度条 第六周
    数组练习3 求最大连通子数组的和
    03构建之法阅读笔记之三
    团队项目个人每日总结(4.19)
  • 原文地址:https://www.cnblogs.com/huige1004/p/1339697.html
Copyright © 2011-2022 走看看