VB.NET tutorial: Clean up objects |
|||||||||||||||||||||||||||
DictionaryClean up objectsWhen the form loads many objects such as cn, rs, ad, com, and reader, are also created in the program for uses and these objects occupy spaces in computer memory. When the form is closed these objects should be released from the memory.
Private Sub Dic_FormClosed(ByVal sender As Object, ByVal e As
System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed Another thing we want to talk here is to let the user close the program when his/her clicks on the Close sub menu item form the File menu. This task can be done simply by attaching the following code to the Click event of the Close sub menu item:
Private Sub CloseToolStripMenuItem1_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles CloseToolStripMenuItem1.Click Now, let test your program and enjoy with it. If you have any questions regard this sample project, we recommend you to post them in our computer forum found in top menu of every web page.
|
| ||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||