請教.net winform高手

我是.net新手,做了一個project,用了很多form,沒用MDI form。就是希望從一個form,點擊一個button,打開另外一個,但是關掉原來那個。我是button click裏是這麽做的:

using (SGeneric generic = new SGeneric())
{
//generic.Dock = DockStyle.Fill;
generic.Location = this.Location;
generic.ClientSize = new Size(this.ClientSize.Width, this.ClientSize.Height);
generic.ShowDialog();
}
this.Close();

可是發現每次點擊都會建一個新的instance,memory一直在漲。不知道怎樣才能解決這個問題?我用的是.net 2.0。

請各位給點建議,多謝多謝!

所有跟帖: 

come here... -HappyNow?!- 給 HappyNow?! 發送悄悄話 HappyNow?! 的博客首頁 (187 bytes) () 10/21/2009 postreply 14:06:59

回複:come here... -相逢是緣- 給 相逢是緣 發送悄悄話 相逢是緣 的博客首頁 (22 bytes) () 10/21/2009 postreply 20:57:05

just wild guess...... -撅著挺好- 給 撅著挺好 發送悄悄話 (1068 bytes) () 10/21/2009 postreply 17:16:11

咦~~, .net怎麽看著象VBA呢? -小謀- 給 小謀 發送悄悄話 小謀 的博客首頁 (0 bytes) () 10/21/2009 postreply 19:30:09

some .net role need to do VBA. i'm not familiar with it. -撅著挺好- 給 撅著挺好 發送悄悄話 (0 bytes) () 10/21/2009 postreply 19:58:49

回複:just wild guess...... -相逢是緣- 給 相逢是緣 發送悄悄話 相逢是緣 的博客首頁 (539 bytes) () 10/21/2009 postreply 20:54:39

i might misunderstood u..... -撅著挺好- 給 撅著挺好 發送悄悄話 (361 bytes) () 10/21/2009 postreply 21:43:09

回複:i might misunderstood u..... -相逢是緣- 給 相逢是緣 發送悄悄話 相逢是緣 的博客首頁 (423 bytes) () 10/21/2009 postreply 23:00:29

請您先登陸,再發跟帖!