Created
November 14, 2017 09:30
-
-
Save tamago324/1e66ec433b828dc26d6b3a33db89df9d to your computer and use it in GitHub Desktop.
ボタンで閉じられる以外の場合、ダイアログを表示して、閉じさせないようにする
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Public Class BaseForm | |
''' <summary>ボタンで閉じられたかどうか</summary> | |
Protected isClosedBtn As Boolean = False | |
Private Sub BaseForm_Load(sender As Object, e As EventArgs) Handles MyBase.Load | |
isClosedBtn = False | |
End Sub | |
Private Sub BaseForm_Closed(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing | |
If Not isClosedBtn Then | |
MsgBox("ボタンで閉じて!") | |
e.Cancel = True | |
End If | |
End Sub | |
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click | |
isClosedBtn = True | |
Me.Close() | |
End Sub | |
End Class |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment