小弟我做一个小工具,这部分代码需用从txt文件将数据导入Assess表中,txt文件最大的有25万左右,
进度条正常,可是Label1.Captiond的值在运行时,看不到,完成后显示100%,单步调试时,可以看到Label1.Captiond的值为1%,2%慢慢地增加,不知是什么原因,请大家多多帮助.先谢过.Private Sub Command1_Click()
Dim con As ADODB.Connection
Dim cmd As ADODB.Command
Dim aa As String
Dim str As String
Dim linecount As Long
Dim i As LongSet con = New ADODB.Connection
Set cmd = New ADODB.Commandcon.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + App.Path + "\number.mdb;Persist Security Info=False"
con.OpenSet cmd.ActiveConnection = conlinecount = 0
i = 0Open App.Path + "\text.txt" For Input As #1
  Do While Not EOF(1)
     Input #1, aa
     linecount = linecount + 1
  Loop
Close #1MsgBox linecount
ProgressBar1.Max = linecountOpen App.Path + "\text.txt" For Input As #1
  Do While Not EOF(1)
     Input #1, aa
     str = "insert into old_right (number_right) values ('" + Trim(aa) + "')"
     cmd.CommandText = str
     cmd.Execute
     i = i + 1
     Label1.Caption = Format(ProgressBar1.Value * 100 / ProgressBar1.Max, "##") & "%"
     ProgressBar1.Value = i
  Loop
Close #1con.Close
Set con = NothingEnd Sub