以下是引用有点蓝在2018/12/17 20:27:00的发言:列名必须是_sortkey
t.DataTable.DataCols.Add("_sortkey", Gettype(Decimal))
老师,您说为啥我移上不管用,就是语句写了,但是实际没有移动
此主题相关图片如下:33.png

老师,就是这个倒数第三行的那个合计行,我想把它移动到最后一行
代码如下:
If e.Form.Controls("CheckBox2").Checked = True Then ''如果垂直分组列被选中,则进行下面处理,确保合计行位于最后一行,首先需要添加临时列,否则不能移动行
t.DataTable.DataCols.Add("_sortkey", Gettype(Decimal))
''移动合计行
For Each r As Row In t.Rows
If r("单位") = "合计" And r.Index <> t.Rows.Count-1 Then
MessageBox.Show(r.Index)
r.Move(t.Rows.Count-1)
MessageBox.Show(r.Index)
End If
Next
End If