at the top pane there will be two drop down box ....
on the left side drop down box select "overrides" and right side select
"onclosed " and ur subroutine will be generated .. u can write the code here ..and whenever u click the close X button on ur form .. this subroutine will be executed..
if you typed in this form_closing(...) event yourself rather than select it from the object and event drop downs, you'll get the error you're getting - can't be found..... why? because the form_closing() event hasn't been registered under your region section. open this up and see if the event is being shown there.
form_closing is the vb6 way, which is NOT supported in .net
there are two close-releated events in vb.net:
Closing which is fired when the form is about to be closed (can can cancel a close in this event by useing e.cancel = (true/false)
Closed which is fired when the form is closed and this is where you put your save settings code
here's an example:
Private Sub Form1_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
e.Cancel = True
Private Sub Form1_Closed(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Closed
Also note that these two events fire when the form is closeing IE if you have a button (btnExit) or a menu item (mnuExit) which contains "Me.Close" that will produce the same result as if someone click the "X" in the top corner of the form. Because Me.Close will close the form and those events are fired.
in the designer Code View in the top left portion of the window (just above where to cade starts) there's two drop down lists, the left one displays all objects IE buttons, menus, textboxes, labels, etc... and once you select one the right hand one displays all the events you can use/code for. so in the left one select the forth from the top titled "(Form1 Events)" yes it's in parenthasis. now on the right select Closed or Closing now the editer adds:
Private Sub Form1.... HANDLES Form1.Closing (or Form1.Closed if that's the event you selected from the right hand drop-down)
if your editer does not do that you're either doing it wrong (buy and read several books) or you're not useing vb.net (any version) and you need to upgrade from vb6 (or older) then start posting on this forum.