以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  同时进度条和标签,标签不显示记录号,速度慢  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=101106)

--  作者:xxcwdlwgo
--  发布时间:2017/5/25 8:51:00
--  同时进度条和标签,标签不显示记录号,速度慢
1 Dim lb2 As WinForm.Label = e.Form.Controls("Label2")
2 Dim p As WinForm.ProgressBar
3 p = e.Form.Controls("ProgressBar1")
4 p.Maximum = DataTables("xjkh_lwg").DataRows.Count
5 p.Minimum = 0 \'设置最小值
6 p.Value = 0 \'设置当前值
7 lb2.Text = "正在分析数据……"
8 Dim Arys As List(Of String())
9 Arys = DataTables("dtgk_lwg").GetValues("使用车站|电梯编号|巡检点1|巡检点2") 
10 MainTable = Tables("xjkh_lwg")
11 For Each dr As DataRow In DataTables("xjkh_lwg").DataRows
13    For Each Ary As String() In Arys
14        If dr("使用车站") = ary(0) And (dr("placename") = ary(2) Or dr("placename") = ary(3))  Then \'如果等于使用车站和巡检点1
15            dr("dtcode") = ary(1)
16            dr("xjsx") = ary(2) & "," & ary(3)
17        End If
18    Next
19    p.Value = p.Value + 1
20    \'lb2.Text =  lb2.text &  p.Value & "/" & p.Maximum
21 Next

问题1、加入lb2后,循环时不显示“正在分析数据……   记录号/总记录数”
问题2、速度慢

--  作者:有点色
--  发布时间:2017/5/25 12:07:00
--  
1 Dim lb2 As WinForm.Label = e.Form.Controls("Label2")
2 Dim p As WinForm.ProgressBar
3 p = e.Form.Controls("ProgressBar1")
4 p.Maximum = DataTables("xjkh_lwg").DataRows.Count
5 p.Minimum = 0 \'设置最小值
6 p.Value = 0 \'设置当前值
7 lb2.Text = "正在分析数据……"
8 Dim Arys As List(Of String())
9 Arys = DataTables("dtgk_lwg").GetValues("使用车站|电梯编号|巡检点1|巡检点2") 
10 MainTable = Tables("xjkh_lwg")
    SystemReady = False
11 For Each dr As DataRow In DataTables("xjkh_lwg").DataRows
13    For Each Ary As String() In Arys
14        If dr("使用车站") = ary(0) And (dr("placename") = ary(2) Or dr("placename") = ary(3))  Then \'如果等于使用车站和巡检点1
15            dr("dtcode") = ary(1)
16            dr("xjsx") = ary(2) & "," & ary(3)
17        End If
18    Next
19    p.Value = p.Value + 1
20    lb2.Text =  lb2.text &  p.Value & "/" & p.Maximum
       Application.DoEvents
21 Next
    SystemReady = True