我在附加文件时遇到加载进度条的问题。我希望进度条在完成扫描附件文件之前一直工作。问题是当我附加文件并开始扫描时,我的进度条可能工作 3-5 秒,我希望进度条会一直持续到文件完成扫描。
这是我的 opendialog 代码:
Private Sub OpenFileDialog1_FileOk(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles OpenFileDialog1.FileOk
strm = OpenFileDialog1.OpenFile()
filename = OpenFileDialog1.FileName
OpenFileDialog1.Filter = "Excel files (*.xls)|*.xls|All files (*.*)|*.*"
TextBox1.Text = filename
If Not (strm Is Nothing) Then
strm.Close()
End If
End Sub
浏览按钮代码:
Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
OpenFileDialog1.Title = "Please Select a File"
OpenFileDialog1.InitialDirectory = "C:temp"
OpenFileDialog1.Filter = "Excel files (*.xls)|*.xls|All files (*.*)|*.*"
OpenFileDialog1.ShowDialog()
End Sub
生成附件的代码:
Private Sub cmdGenerate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdIntralinks.Click
conn.Open()
Timer1.Enabled = True
Timer1.Interval = 50
ProgressBar1.Value = 0
conn.close()
timer1_tick 的代码:
Private Sub Timer1_Tick_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Static TikTok As Integer
TikTok = TikTok + 1
ProgressBar1.Value = TikTok
If ProgressBar1.Value = ProgressBar1.Maximum Then
Timer1.Enabled = False
TikTok = 0
End If
End Sub