VB.net 在一个From 关闭后切换到另一From 实现方法,并加载XP视觉样式
2007-05-11 13:58 ruinet 阅读(1069) 评论(0) 收藏 举报
在Vb.net 中不能象vb中
from2.show()
from1.close在 from2显示后关闭from1,在vb.net中如果关闭了from1整个程序都退出了.
要能实现vb中的效果只能在新建一个模块,并在模块中建一个Main函数,使程序从模块启动或Main启动.
设置如图:

在模块中实现代码如下:
Module DB
Public Sub Main()
Try
MainFrm = New frmMain
System.Windows.Forms.Application.EnableVisualStyles()'加载 XP视觉效果
System.Windows.Forms.Application.Run(New FrmLogin)

If IsLogin Then
System.Windows.Forms.Application.Run(MainFrm)
End If

Catch ex As Exception
MsgBox(ex.Message)

End Try

End Sub
End Module
from2.show()
from1.close在 from2显示后关闭from1,在vb.net中如果关闭了from1整个程序都退出了.
要能实现vb中的效果只能在新建一个模块,并在模块中建一个Main函数,使程序从模块启动或Main启动.
设置如图:
在模块中实现代码如下:
Module DB
Public Sub Main()
Try
MainFrm = New frmMain
System.Windows.Forms.Application.EnableVisualStyles()'加载 XP视觉效果
System.Windows.Forms.Application.Run(New FrmLogin)
If IsLogin Then
System.Windows.Forms.Application.Run(MainFrm)
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
End Module


浙公网安备 33010602011771号