以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 提个状态栏显示数据加载真实进度条的小问题? (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=40728) |
-- 作者:jnletao -- 发布时间:2013/9/27 15:37:00 -- 提个状态栏显示数据加载真实进度条的小问题? If MainTable.Name = "OrderList" Then If DataTables("OrderList").DataRows.Count > 0 Then \'如果订单表没有数据 Dim ids As String For Each dr As DataRow In DataTables("OrderList").DataRows ids = ids & "," & "\'" & dr("OrderID") & "\'" Next ids= ids.Trim(",") \'MessageBox.show(ids) DataTables("BagRegList").LoadFilter = "OrderID In (" & ids & ")" DataTables("NoteList").LoadFilter = "OrderID In (" & ids & ")" DataTables("OrderColorSize").LoadFilter = "OrderID In (" & ids & ")" DataTables("OrderFabricPlan").LoadFilter = "OrderID In (" & ids & ")" DataTables("OrderMaterialPlan").LoadFilter = "OrderID In (" & ids & ")" DataTables("OrderProductPlan").LoadFilter = "OrderID In (" & ids & ")" DataTables("OrderProductProcess").LoadFilter = "OrderID In (" & ids & ")" DataTables("RecordBagList").LoadFilter = "OrderID In (" & ids & ")" DataTables("RecordList").LoadFilter = "OrderID In (" & ids & ")" DataTables("CutRecord").LoadFilter = "OrderID In (" & ids & ")" DataTables("CutRecordProcessWorker").LoadFilter = "OrderID In (" & ids & ")" DataTables("CutRecordFabricList").LoadFilter = "OrderID In (" & ids & ")" \'--------------------- DataTables("BagRegList").Load() DataTables("NoteList").Load() DataTables("OrderColorSize").Load() DataTables("OrderFabricPlan").Load() DataTables("OrderMaterialPlan").Load() DataTables("OrderProductPlan").Load() DataTables("OrderProductProcess").Load() DataTables("RecordBagList").Load() DataTables("RecordList").Load() DataTables("CutRecord").Load() DataTables("CutRecordProcessWorker").Load() DataTables("CutRecordFabricList").Load() DataTables("OrderStatus").Load() DataTables("结算状态").Load() End If End If 如何在上面代码里加个 在状态栏显示数据真实加载的进度条,不要滚动的, 就是0--100 显示真实进度的。 上面代码统计总值太麻烦。有什么好方法没? |
-- 作者:Bin -- 发布时间:2013/9/27 15:39:00 -- 10个表,每加载完一个表就显示多10% 这样相对来说比较简单. |
-- 作者:jnletao -- 发布时间:2013/9/27 15:42:00 -- 好办法,检测每个表加载完是用什么代码? |
-- 作者:hanxuntx -- 发布时间:2013/9/27 15:44:00 -- 不用检测 直接现在对应的load代码下一行 |
-- 作者:jnletao -- 发布时间:2013/9/27 16:02:00 -- 已做好,如有代码冗余或不严谨的地方请指教 If MainTable.Name = "OrderList" Then If DataTables("OrderList").DataRows.Count > 0 Then \'如果订单表没有数据 Dim ids As String For Each dr As DataRow In DataTables("OrderList").DataRows ids = ids & "," & "\'" & dr("OrderID") & "\'" Next ids= ids.Trim(",") \'MessageBox.show(ids) DataTables("BagRegList").LoadFilter = "OrderID In (" & ids & ")" DataTables("NoteList").LoadFilter = "OrderID In (" & ids & ")" DataTables("OrderColorSize").LoadFilter = "OrderID In (" & ids & ")" DataTables("OrderFabricPlan").LoadFilter = "OrderID In (" & ids & ")" DataTables("OrderMaterialPlan").LoadFilter = "OrderID In (" & ids & ")" DataTables("OrderProductPlan").LoadFilter = "OrderID In (" & ids & ")" DataTables("OrderProductProcess").LoadFilter = "OrderID In (" & ids & ")" DataTables("RecordBagList").LoadFilter = "OrderID In (" & ids & ")" DataTables("RecordList").LoadFilter = "OrderID In (" & ids & ")" DataTables("CutRecord").LoadFilter = "OrderID In (" & ids & ")" DataTables("CutRecordProcessWorker").LoadFilter = "OrderID In (" & ids & ")" DataTables("CutRecordFabricList").LoadFilter = "OrderID In (" & ids & ")" \'--------------------- StatusBar.Message1= "正在加载订单表及对应子表" StatusBar.ProgressBar.Visible =True StatusBar.Refresh DataTables("BagRegList").Load() StatusBar.ProgressBar.Value = 8 StatusBar.Message2= "8%" StatusBar.Refresh DataTables("NoteList").Load() StatusBar.ProgressBar.Value = 16 StatusBar.Message2= "16%" StatusBar.Refresh DataTables("OrderColorSize").Load() StatusBar.ProgressBar.Value = 24 StatusBar.Message2= "24%" StatusBar.Refresh DataTables("OrderFabricPlan").Load() StatusBar.ProgressBar.Value = 32 StatusBar.Message2= "32%" StatusBar.Refresh DataTables("OrderMaterialPlan").Load() StatusBar.ProgressBar.Value = 40 StatusBar.Message2= "40%" StatusBar.Refresh DataTables("OrderProductPlan").Load() StatusBar.ProgressBar.Value = 48 StatusBar.Message2= "48%" StatusBar.Refresh DataTables("OrderProductProcess").Load() StatusBar.ProgressBar.Value = 56 StatusBar.Message2= "56%" StatusBar.Refresh DataTables("RecordBagList").Load() StatusBar.ProgressBar.Value = 64 StatusBar.Message2= "64%" StatusBar.Refresh DataTables("RecordList").Load() StatusBar.ProgressBar.Value = 72 StatusBar.Message2= "72%" StatusBar.Refresh DataTables("CutRecord").Load() StatusBar.ProgressBar.Value = 80 StatusBar.Message2= "80%" StatusBar.Refresh DataTables("CutRecordProcessWorker").Load() StatusBar.ProgressBar.Value = 88 StatusBar.Message2= "88%" StatusBar.Refresh DataTables("CutRecordFabricList").Load() StatusBar.ProgressBar.Value = 100 StatusBar.Message2= "100%" StatusBar.Refresh StatusBar.Reset() End If End If |
-- 作者:lsy -- 发布时间:2013/9/27 16:50:00 -- 进度虽然不太精确,好歹有个交代,用户心里有数。 |
-- 作者:jspta -- 发布时间:2013/9/27 21:03:00 -- 学习下for语句吧,减少50%的代码,增强可读性和便于后续修改 |