以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  需要进度条  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=132061)

--  作者:表叔
--  发布时间:2019/3/13 8:40:00
--  需要进度条

在下面的代码里加入进度条!

 

For Each file As String In filesys .GetFiles("\\\\Win-ukpedgbcajr\\财务部狐表业务系统\\产品统计\\产品开票信息")
    If file.EndsWith(".xls") OrElse file.EndsWith(".xlsx") Then
        Dim Book As New XLS.Book(file)
        Dim Sheet As XLS.Sheet = Book.Sheets(0)
        Dim jsdw As String = sheet(11,1).Text  \'结算单位在Excel中的坐标位置
        Dim nms() As String = {"行号","商品编号","商品名称","单据日期","单据类型","单据编号","出库数量","原币出库金额","开票数量","原币开票金额","未开票数量","原币未开票金额","超额开票数量","原币超额开票金额","手工开票数量","原币手工开票金额"}
        \' Tables("成品统计表").StopRedraw()
        For n As Integer = 16 To Sheet.Rows.Count -1 \'注意下面的循环变量从17开始,而不是从0开始,因为Excel表的第1-16行是标题和列名
            Dim r As Row = Tables("成品统计表").AddNew()
            For m As Integer = 0 To nms.Length - 1
                r(nms(m)) = Sheet(n,m).Value
            Next
            r("结算单位") = jsdw
        Next
    End If
Next

 这个代码写在按钮(导入数据)里面,单击按钮显示找不到名称为“ProgressBar1”的控件!

[此贴子已经被作者于2019/3/13 10:20:09编辑过]

--  作者:有点甜
--  发布时间:2019/3/13 8:53:00
--  

参考一下这里

 

http://www.foxtable.com/webhelp/scr/0793.htm

 

Dim files = filesys .GetFiles("\\\\Win-ukpedgbcajr\\财务部狐表业务系统\\产品统计\\产品开票信息")
Dim i As Integer = 0
Dim p As WinForm.ProgressBar
p = e.Form.Controls("ProgressBar1")
p.Maximum = files.count * 100
p.Minimum = 0 \'设置最小值
p.Value = 0 \'设置当前值
For Each file As String In files
    i += 1
    If file.EndsWith(".xls") OrElse file.EndsWith(".xlsx") Then
        Dim Book As New XLS.Book(file)
        Dim Sheet As XLS.Sheet = Book.Sheets(0)
        Dim jsdw As String = sheet(11,1).Text  \'结算单位在Excel中的坐标位置
        Dim nms() As String = {"行号","商品编号","商品名称","单据日期","单据类型","单据编号","出库数量","原币出库金额","开票数量","原币开票金额","未开票数量","原币未开票金额","超额开票数量","原币超额开票金额","手工开票数量","原币手工开票金额"}
        \' Tables("成品统计表").StopRedraw()
        For n As Integer = 16 To Sheet.Rows.Count -1 \'注意下面的循环变量从17开始,而不是从0开始,因为Excel表的第1-16行是标题和列名
            Dim r As Row = Tables("成品统计表").AddNew()
            For m As Integer = 0 To nms.Length - 1
                r(nms(m)) = Sheet(n,m).Value
            Next
            r("结算单位") = jsdw
            p.value += 100 / (sheet.Rows.count-16)
        Next
    End If
    p.value = i * 100
Next


 


--  作者:表叔
--  发布时间:2019/3/13 10:26:00
--  
以下是引用有点甜在2019/3/13 8:53:00的发言:

参考一下这里

 

http://www.foxtable.com/webhelp/scr/0793.htm

 

Dim files = filesys .GetFiles("\\\\Win-ukpedgbcajr\\财务部狐表业务系统\\产品统计\\产品开票信息")
Dim i As Integer = 0
Dim p As WinForm.ProgressBar
p = e.Form.Controls("ProgressBar1")
p.Maximum = files.count * 100
p.Minimum = 0 \'设置最小值
p.Value = 0 \'设置当前值
For Each file As String In files
    i += 1
    If file.EndsWith(".xls") OrElse file.EndsWith(".xlsx") Then
        Dim Book As New XLS.Book(file)
        Dim Sheet As XLS.Sheet = Book.Sheets(0)
        Dim jsdw As String = sheet(11,1).Text  \'结算单位在Excel中的坐标位置
        Dim nms() As String = {"行号","商品编号","商品名称","单据日期","单据类型","单据编号","出库数量","原币出库金额","开票数量","原币开票金额","未开票数量","原币未开票金额","超额开票数量","原币超额开票金额","手工开票数量","原币手工开票金额"}
        \' Tables("成品统计表").StopRedraw()
        For n As Integer = 16 To Sheet.Rows.Count -1 \'注意下面的循环变量从17开始,而不是从0开始,因为Excel表的第1-16行是标题和列名
            Dim r As Row = Tables("成品统计表").AddNew()
            For m As Integer = 0 To nms.Length - 1
                r(nms(m)) = Sheet(n,m).Value
            Next
            r("结算单位") = jsdw
            p.value += 100 / (sheet.Rows.count-16)
        Next
    End If
    p.value = i * 100
Next


 这个代码写在按钮(导入数据)里面,单击按钮显示找不到名称为“ProgressBar1”的控件!


--  作者:有点甜
--  发布时间:2019/3/13 10:35:00
--  

请在自己的窗口添加进度条控件

 

http://www.foxtable.com/webhelp/scr/0793.htm