以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- [求助] 程序运行 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=138696) |
||||
-- 作者:susanhe -- 发布时间:2019/8/3 14:29:00 -- [求助] 程序运行 你好,当按下按钮里,可否出现个程序执行进度状态条,显示所剩时间,总用时间等,谢谢。
附上实例。
|
||||
-- 作者:有点蓝 -- 发布时间:2019/8/3 15:12:00 -- 添加一个进度条控件 Dim d1 As Date = Date.Now DataTables("表A").datarows.clear Dim lst As List(of String) = DataTables("表B").GetValues("姓名") For Each s As String In DataTables("表C").GetValues("姓名") If lst.Contains(s) = False Then lst.Add(s) Next Dim pb As WinForm.ProgressBar = e.Form.Controls("ProgressBar1") pb.Maximum = lst.Count For Each s As String In lst Dim dr As DataRow = DataTables("表A").AddNew dr("姓名") = s dr("总分")= DataTables("表B").compute("sum(分数)" ," 姓名=\'" & s & "\' ") +DataTables("表C").compute("sum(分数)" ," 姓名=\'" & s & "\' ") pb.Value += 1 Application.DoEvents() Next msgbox("用时" & (Date.Now - d1).TotalMinutes) |
||||
-- 作者:susanhe -- 发布时间:2019/8/3 15:59:00 -- 这个一直在窗口界面上,可以在运行时出现,平时都不出现,过程中还能显示百分比吗? |
||||
-- 作者:有点蓝 -- 发布时间:2019/8/3 16:11:00 -- 把进度条控件设置为隐藏,运行的时候再显示。百分比另外使用标签控件实现 |
||||
-- 作者:susanhe -- 发布时间:2019/8/3 17:42:00 -- 有点不懂,可以在实例上做个样品本吗? 谢谢。
|
||||
-- 作者:有点蓝 -- 发布时间:2019/8/4 20:37:00 --
|
||||
-- 作者:susanhe -- 发布时间:2019/8/4 21:04:00 -- 这个不对呀,如图。 执行第二次成 200%,第三次 300%。执行完也不会自动消失,谢谢。 ![]() ![]() |
||||
-- 作者:有点蓝 -- 发布时间:2019/8/4 21:31:00 -- 很简单的问题。我们回复的代码你们就都看不懂? Dim cnt As Integer = lst.Count Dim pb As WinForm.ProgressBar = e.Form.Controls("ProgressBar1") pb.Maximum = cnt pb.Value = 0 pb.Visible = True |