from2.show()
from1.close在 from2显示后关闭from1,在vb.net中如果关闭了from1整个程序都退出了.
要能实现vb中的效果只能在新建一个模块,并在模块中建一个Main函数,使程序从模块启动或Main启动.
设置如图:
在模块中实现代码如下:
Module DB
Module DB
Public Sub Main()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
Public Sub Main()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