best SDI methods

R

R.A.F.

Hi,

I would like to have your advice regarding a simple SDI application.
i have 3 forms : FMain, FMainHW and FMainSW.
when my application run FMain display the main menu and interface of the
SDI application.
in this menu i have 2 items HW and SW.

when i click on HW item, it should display FMainHW form into the SDI
application.
when i click on SW item, it should display FMainSW form into this SDI
application.

for that i use the following code :

private void MenuSW_Click(object sender, EventArgs e)
{
TSContainer.ContentPanel.Controls.Clear();
if (this.fmSW != null)
{
fmSW.Parent = TSContainer.ContentPanel;
fmSW.Show();
}
else
{
fmSW = new FMainSW();
fmSW.TopLevel = false;
fmSW.Parent = TSContainer.ContentPanel;
fmSW.Show();
}
}

a similar code is used for HW item.

however, i guess it is not the best method because the memory usage
starts at 19.490 Kb and at each click (switching between the 2 menu
items) it increases a little bit.

so, what is the best way to display in my SDI form other forms without
increasing memory usage.
fmSW and fmHW are private data members of my FMain form class.

thanks a lot,
RAF
 
N

Nicholas Paldino [.NET/C# MVP]

RAF,

If I had to guess, you are looking at the task manager to determine your
memory usage. This is not the amount of memory that you are using, but
rather, the working set, which is a completely different thing.

If you want to get a true indication of how much memory is being used,
you need to look at the performance counters for .NET.

You should look there first to see what your actual memory usage is, and
then see if it is outside of your expectations.
 
R

R.A.F.

But do you think the method i used to display forms in SDI application,
is correct ?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top