请教.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

请您先登陆,再发跟帖!