我想讓我的Visual Basic應用程序運行帶有進度條的啓動畫面,然後檢查文件是否存在,但自從啓動以來,我遇到了問題,啓動屏幕顯示文件檢查器啓動,但我希望它檢查何時加載而不是啓動屏幕form1
。這裏是我的代碼,我可以用一個忠告:Visual basic 2010檢查文件是否存在於表單加載
閃屏:
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
當你需要* *之一,50毫秒是不夠的,只有使用閃屏。同樣,只有當你知道需要多長時間時才使用進度條。你不知道。 –