tags:

views:

20

answers:

1

I have this code that tries to kill the wampmanager process when the user press on a button. But how can I achieve the same thing if the user clicks on the close button. Is it possible to execute a small line of code just when the user clicks on the close button? If you know any alternatives in achieving this, please do tell. thanks

  Dim pProcess() As Process = System.Diagnostics.Process.GetProcessesByName("wampmanager")

            For Each p As Process In pProcess
                p.Kill()
            Next
+1  A: 

you can use the FormClosing event for that. You can have a common function and call them in button Click and this event.

Shoban