RDLC就一个RowNumber的函数能用来做序号,但是往往我们更需要的是分组序号,而非行序号。不说废话了,先上代码。
1
Dim
count
As
Integer
2 public function GroupCount( reset As Boolean ) As Integer
3 if ( reset ) then
4 count = 0
5 end if
6 count = count + 1
7 return count
8 end function
2 public function GroupCount( reset As Boolean ) As Integer
3 if ( reset ) then
4 count = 0
5 end if
6 count = count + 1
7 return count
8 end function
将以上代码添加在报表的自定义代码区域(RDLC的自定义代码代码必须是是VB6.0的代码),之后在要显示序号的地方调用类似如下的代码:
=
Code.GroupCount(
False
)
附上判断分组改变的方法:
First(Fields!FieldName.Value,
"
RowGroupName
"
)
=
Fields!FieldName.Value
为True则为分组改变了,否则则分组未变。