以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  [求助]复制数据时加上进度条  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=187830)

--  作者:huaziqiao1976
--  发布时间:2023/8/15 12:34:00
--  [求助]复制数据时加上进度条
Dim cmd2 As New SQLCommand
cmd2.C
Dim dt4 As DataTable
Dim Cols3() As String = {"f_zh","f_nh","f_ywh","f_lb","f_rq"}
Dim Cols4() As String = {"账号","年号","业务号","摘要","日期"}
cmd2.CommandText = "S*ELECT * From {tb_khrgtgxh} where f_nh = \'" & nh & "\'"
dt4 = cmd2.ExecuteReader()

Dim p As WinForm.ProgressBar
p = e.Form.Controls("ProgressBar1")
p.Maximum = dt5.Count - 1   \'设置最大值
p.Minimum = 0 \'设置最小值
p.Value = 0 \'设置当前值

请教这部份进度条怎么写

--  作者:有点蓝
--  发布时间:2023/8/15 13:40:00
--  
dt4 = cmd2.ExecuteReader()
Dim p As WinForm.ProgressBar
p = e.Form.Controls("ProgressBar1")
p.Maximum = dt4 .Count - 1   \'设置最大值
p.Minimum = 0 \'设置最小值
For Each dr As DataRow In dt4 .DataRows
    Dim 
nr As DataRow = DataTables("员工").AddNew()
    For 
i As Integer =0 To sCols.Length -1
        
nr(dCols(i)) = dr(sCols(i))
    Next
p.Value = 0
Application.DoEvents
Next

--  作者:huaziqiao1976
--  发布时间:2023/8/15 13:51:00
--  
p.Maximum = dt4 .Count - 1   \'设置最大值 ,
提示 count 不是 DataTable的成员

--  作者:有点蓝
--  发布时间:2023/8/15 13:54:00
--  
p.Maximum = dt4 .datarows.Count - 1  

--  作者:huaziqiao1976
--  发布时间:2023/8/15 14:10:00
--  
没有报错,但进度条不动
--  作者:有点蓝
--  发布时间:2023/8/15 14:13:00
--  
贴出完整代码看看
--  作者:huaziqiao1976
--  发布时间:2023/8/15 14:17:00
--  
Dim cmd2 As New SQLCommand
c*md2.C
Dim dt4 As DataTable
Dim Cols3() As String = {"f_zh","f_nh","f_ywh","f_lb","f_rq"}
Dim Cols4() As String = {"账号","年号","业务号","摘要","日期"}
cmd2.CommandText = "S*ELECT * From {tb_khrgtgxh} where f_nh = \'" & nh & "\'"
dt4 = cmd2.ExecuteReader()
Dim p As WinForm.ProgressBar
p = e.Form.Controls("ProgressBar1")
p.Maximum = dt4.datarows.Count - 1   \'设置最大值
p.Minimum = 0 \'设置最小值
For Each dr3 As DataRow In dt4.DataRows
    Dim dr4 As DataRow = DataTables("股金账页").AddNew()
    For i2 As Integer = 0 To Cols3.Length -1
        dr4(Cols4(i2)) = dr3(Cols3(i2))     
    Next
    p.Value = 0
    Application.DoEvents
 Next


--  作者:有点蓝
--  发布时间:2023/8/15 14:20:00
--  
Dim dr3 As DataRow
For i as integer = 0 to  dt4.DataRows.count - 1
dr3 = dt4.DataRows(i)
    Dim dr4 As DataRow = DataTables("股金账页").AddNew()
    For i2 As Integer = 0 To Cols3.Length -1
        dr4(Cols4(i2)) = dr3(Cols3(i2))     
    Next
    p.Value = i
    Application.DoEvents
 Next

--  作者:huaziqiao1976
--  发布时间:2023/8/15 14:30:00
--  
解决了,谢谢蓝版