| |

VerySource

 Forgot password?
 Register
Search
View: 810|Reply: 2

Questions about multiple ways to close the window ??

[Copy link]

1

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-2-13 12:30:01
| Show all posts |Read mode
In a quick way, there is a method closeform, whose function is to close the form1 window (using the UNLOAD method). Now I want to ask, how do I distinguish between the method closeform or the form1 window in the unload event of the window? The fork on the body is closed, do not use the flag variable, is there any other way, ask for advice
Reply

Use magic Report

0

Threads

34

Posts

17.00

Credits

Newbie

Rank: 1

Credits
17.00

 China

Post time: 2020-4-12 19:45:02
| Show all posts
Pass the UnloadMode parameter in the QueryUnload event of the form
If the UnloadMode value is 0, it is closed with the fork on the form1 form
If UnloadMode value is 1, it is closed with unload

Private Sub Form_QueryUnload (Cancel As Integer, UnloadMode As Integer)
Debug.Print UnloadMode
End Sub
Reply

Use magic Report

0

Threads

34

Posts

17.00

Credits

Newbie

Rank: 1

Credits
17.00

 China

Post time: 2020-4-12 22:30:02
| Show all posts
Private Sub Command1_Click ()
Unload Me
End Sub

Private Sub Form_QueryUnload (Cancel As Integer, UnloadMode As Integer)
If UnloadMode = 0 Then
MsgBox "Form close button close"
ElseIf UnloadMode = 1 Then
MsgBox "Unload method off"
End If
End Sub
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list