burak Posted April 9, 2004 Posted April 9, 2004 Hello, In one of my winforms pages, I launch another form as follows Private Sub btnExtract_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnExtract.Click Dim page As New ShowCourses page.Show() End Sub When this form comes up, I fill a datagrid and then set the dataset and datadapter to nothing. After the user looks at the datagrid, they can close this page as follows: Private Sub btnBack_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBack.Click Me.Close() End Sub I observed the Memory Usage for this app from the Processes tab in the Windows Task Manager and it looked lke the memory usage stayed the same even though this form was closed. How do we close a form and release the memory it uses back to the system? Thank you, Burak Quote
Administrators PlausiblyDamp Posted April 9, 2004 Administrators Posted April 9, 2004 You could call the Dispose method of the form to free up memory quicker. However memory management under .Net uses garbage collection - this means memory isn't freed up immediately, but rather when the system deems it necessary. Search these forums for 'Garbage Collection' and you will find several threads that discuss this issue. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
burak Posted April 9, 2004 Author Posted April 9, 2004 Thank you, Would you also happen to know the answer to this problem??? Cannot access disposed object named 'DataGridTextBox' Hello, I am working on a windows forms app with a datagrid. In my mouse down event, I am calling Me.Close() and am running into the following error Cannot access disposed object named "DataGridTextBox" Object name: "DataGridTextBox" Private Sub dtgResults_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles dtgResults.MouseDown Dim str As String = "" Dim hti As DataGrid.HitTestInfo hti = dtgResults.HitTest(e.X, e.Y) Try If hti.Type = DataGrid.HitTestType.Cell Or hti.Type = DataGrid.HitTestType.RowHeader Then str += dtgResults(hti.Row, 0).ToString() global_vars.PROVIDS = str End If Catch ex As Exception MsgBox(ex.Message) End Try If str <> "" Then Me.Close() End If End Sub What am I doing wrong? Burak Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.