如何在一个窗体中对另一个窗体进行操作?

如我要打开另一个窗体并关闭原本的窗体
原来的VB6直接用
form2.show
form1.close
就行了
.net把它变成类了,该怎么做
[117 byte] By [GhostII-Ghost] at [2008-2-12]
# 1
Form2 form2 = new Form2()
form2.Show()
me.hide()
# 2
一样,只不过要先建立对象。
dim xxxxx as new form1
xxxxx.show
scegg-Silent at 2007-10-26 > top of Msdn China Tech,.NET技术,VB.NET...
# 3
无效的,当form1被关闭的时候,在form1中定义的变量也将被释放

新打开的form2马上就会被系统关掉
GhostII-Ghost at 2007-10-26 > top of Msdn China Tech,.NET技术,VB.NET...
# 4
http://www.Codefund.cn/develop/read_article.asp?id=22121
momo1113-千里猪 at 2007-10-26 > top of Msdn China Tech,.NET技术,VB.NET...
# 5
......
文章是不错,但还是没写出解决的方法阿
GhostII-Ghost at 2007-10-26 > top of Msdn China Tech,.NET技术,VB.NET...
# 6
http://www.Codefund.cn/develop/read_article.asp?id=22122
momo1113-千里猪 at 2007-10-26 > top of Msdn China Tech,.NET技术,VB.NET...
# 7
dim formName = new FormName()
formName.ShowDialog()
me.close()
njhyh-小辉 at 2007-10-26 > top of Msdn China Tech,.NET技术,VB.NET...
# 8
先建一个类
Module Module1
Public Sub Main()
Form1.Itself.Show()
Application.Run()
End Sub

End Module
在每个窗体加入
Private Shared _Itself As Form1
Public Shared ReadOnly Property Itself() As Form1
Get
If _Itself Is Nothing OrElse _Itself.IsDisposed Then
_Itself = New Form1
End If

Return _Itself
End Get
End Property
在事件中加入
dd.Itself.Show()
'Me.Close()
dd.Itself.TextBox1.Text = "ddd"
试试吧
chenhaohf at 2007-10-26 > top of Msdn China Tech,.NET技术,VB.NET...
# 9
将启动窗体改为Module Module1
chenhaohf at 2007-10-26 > top of Msdn China Tech,.NET技术,VB.NET...
# 10
两个窗体共同使用一个静态类
hfwang009-软件民工 at 2007-10-26 > top of Msdn China Tech,.NET技术,VB.NET...