0
如果存在文件,并尝试关闭或隐藏表单cnx并打开Form Product。 但有些事情是错误的,我不明白为什么这不工作。关闭Form1如果FileExists +打开Form2
Private Sub cnx_Load(sender As Object, e As EventArgs) Handles MyBase.Load
strFileName = "app.txt"
strBasePath = Application.StartupPath
If My.Computer.FileSystem.FileExists(strFileName) = True Then
Product.Show()
Me.Hide()
ElseIf My.Computer.FileSystem.FileExists(strFileName) = False Then
MessageBox.Show("File App.config is Missing! Create a new Database.",
"Something is Wrong!", MessageBoxButtons.OK, MessageBoxIcon.Warning)
End If
End Sub
谢谢。
你有7个问题,得到7个答案,但没有接受。接受答案 - 和投票 - 帮助别人找到好帖子。 [旅游]解释SO如何工作。 – Plutonix
您不能在Load事件中隐藏()表单。 Load事件触发是因为您使用了Show()。您必须返回并找到创建表单的代码,这就是If语句所属的代码。但是你可能想继续这样做,使用Close()来代替,然后使用Project> Properties> Application选项卡> Shutdown mode =关闭上一个窗体。 –
是的,这是....谢谢 – Jamyz