F
Federico Caselli
Hi,
I have a simple memory problem with two forms on a MDI project.
The first form (MainForm) open a second one (ImageForm).
Both the forms have an instance to a dataset (DataSet1).
On the ImageForm Form_Load event, I wrote code to copy all the records from
the MainForm.DataSet1.TB_Images dataTable to the ImageForm.DataSet1.TB_Images
dataTable. Note that TB_Images has an Image Field.
I can't understand why opening and closing ImageForm many times, the
allocated memory continues to grow.
This is the code:
' the MainForm opens the ImageForm:
Private Sub OpenImageForm()
Dim f As New ImageForm
If f.ShowDialog(Me.ParentForm) = Windows.Forms.DialogResult.OK Then
'do stuff (or do nothing, the problem doesn't change)
End If
f = Nothing
End Sub
'the Form_Load event of the ImageForm
Private Sub ImageForm_Load(ByVal sender As System.Object, ByVal e As _
System.EventArgs) Handles MyBase.Load
Me.DataSet1.TB_Images.Clear()
For Each rwImages As DataSet1.TB_ImagesRow In _
CType(Me.Owner, MDIParent)._MainForm.DataSet1.TB_Images
Me.DataSet1.TB_Images.ImportRow(rwImages)
Next
End Sub
Any help appreciated!
I have a simple memory problem with two forms on a MDI project.
The first form (MainForm) open a second one (ImageForm).
Both the forms have an instance to a dataset (DataSet1).
On the ImageForm Form_Load event, I wrote code to copy all the records from
the MainForm.DataSet1.TB_Images dataTable to the ImageForm.DataSet1.TB_Images
dataTable. Note that TB_Images has an Image Field.
I can't understand why opening and closing ImageForm many times, the
allocated memory continues to grow.
This is the code:
' the MainForm opens the ImageForm:
Private Sub OpenImageForm()
Dim f As New ImageForm
If f.ShowDialog(Me.ParentForm) = Windows.Forms.DialogResult.OK Then
'do stuff (or do nothing, the problem doesn't change)
End If
f = Nothing
End Sub
'the Form_Load event of the ImageForm
Private Sub ImageForm_Load(ByVal sender As System.Object, ByVal e As _
System.EventArgs) Handles MyBase.Load
Me.DataSet1.TB_Images.Clear()
For Each rwImages As DataSet1.TB_ImagesRow In _
CType(Me.Owner, MDIParent)._MainForm.DataSet1.TB_Images
Me.DataSet1.TB_Images.ImportRow(rwImages)
Next
End Sub
Any help appreciated!