我希望我的 Visual Basic 应用程序运行带有进度条的启动屏幕,然后检查文件是否存在,但是我遇到了一个问题,因为我一开始并且启动屏幕显示文件检查器就会启动,但是我希望它检查form1
加载时间而不是启动屏幕。这是我的代码,我可以使用一个建议:
启动画面:
Public NotInheritable Class SplashScreen1
'TODO: This form can easily be set as the splash screen for the application by going to the "Application" tab
' of the Project Designer ("Properties" under the "Project" menu).
Private Sub Splashscreen1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim Dte As DateTime = DateTime.Now
Label2.Text = FormatDateTime(Dte, DateFormat.LongDate)
Timer1.Start()
Timer2.Start()
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
If ProgressBar1.Value = ProgressBar1.Maximum Then
Form1.Show()
Me.Close()
End If
End Sub
Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
ProgressBar1.PerformStep()
End Sub
End Class
表格 1:
Imports System.Net
Imports System.IO
Public Class Form1
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If My.Computer.FileSystem.FileExists(Application.StartupPath & "/read me.txt") Then
MsgBox("file found")
Else
MsgBox("not found")
End If
End Sub
End Class