In a vb.net windows application, I need user to confirm before closing application. I have this code in FormClosing event
If BackgroundWorker1.IsBusy Then
Dim UserSelection As Integer = MsgBox("Do you want Cancel Processing and Exit Application?", MsgBoxStyle.Exclamation + MsgBoxStyle.YesNo, "Exit Application")
If UserSelection = 6 Then
BackgroundWorker1.CancelAsync()
e.Cancel = True
Else
????
End If
End If
How can I cancel form closing if user clicked No?
Tried e.Cancel = false but it didn’t work (exits application).
e.Cancel = Truewould stop the form closing.