以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [求助]2个问题集中请教下老师  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=43666)

--  作者:jiskin
--  发布时间:2013/12/12 15:13:00
--  [求助]2个问题集中请教下老师

第一个问题,对于一个窗口表(SQLQuery)做了一个按钮,代码如下

Dim t As Table = Tables("IQC Select_Table1")
Dim n As Short = 0
messagebox.show(t.Rows.Count)
For Each r As Row In t.Rows
    If r.Checked = False Then
        n = n + 1
        messagebox.show(n)
        r.Delete
    End If
Next

 

第一个msg返回的是6,说明有6行

第二个msg返回的是1,然后删除一行

但是只返回到3 就退出了,剩下3行为啥不走了呢

这个表也没啥其他代码呀~~

 

 

第二个问题是,我做excel模板报表的时候 格式如下时

序号 物料描述 物料号 数量
<Index> [Material] [MaterialNumber] [Quantity]

 

我想在生成的细节区做一列竖的内容 需要竖着合并列

一式三联:白联(仓库)红联(财务)黄联(采购)

发现实现不了,有没办法啊?

 

 

ps.其实这俩问题是连在一起的,我是想对表中数据做选择后 生成excel报表,但是excel报表貌似不能对选中项目生成细节,所以想在生成前把未选中的删掉

[此贴子已经被作者于2013-12-12 15:14:41编辑过]

--  作者:Bin
--  发布时间:2013/12/12 15:18:00
--  
循环删除行,帮助有提示过.

For i as integer = t.rows.count-1 to 0 step -1
    If r.Checked = False Then
        n = n + 1
        messagebox.show(n)
        r.Delete
    End If
Next


--  作者:jiskin
--  发布时间:2013/12/12 15:38:00
--  
以下是引用Bin在2013-12-12 15:18:00的发言:
循环删除行,帮助有提示过.

For i as integer = t.rows.count-1 to 0 step -1
    If r.Checked = False Then
        n = n + 1
        messagebox.show(n)
        r.Delete
    End If
Next

 

感谢BIN 大哥!!

For i As Integer = t.rows.count-1 To 0 Step -1
    If t.Rows(i).Checked = False Then
        t.Rows(i).remove
    End If
Next

 

涨姿势了