With DataTables("考核成绩表")
.LoadTop = "100 Percent"
.Load()
End With
Dim lvw As WinForm.ListView = e.Form.Controls("LV训练成绩")
lvw.StopRedraw() '停止绘制
lvw.Groups.Clear() '清除原来的分组
lvw.Columns.Clear() '清除原来的列
lvw.Rows.Clear() '清除原来的行
lvw.Images.Clear() '清除原来的图片
lvw.View = ViewMode.Details '显示模式为详细信息
Dim cls() As String = {"","姓名","XX","XXX","考核情况_完成时间","考核情况_最终得分","等级评定","考核时间"} '定义列名
Dim wds() As Integer = {0,100,100,100,120,120,100,150} '定义列宽
For i As Integer = 0 To cls.Length - 1 '增加列
Dim c As WinForm.ListViewColumn = lvw.Columns.Add()
c.Name = cls(i) '指定列名
c.Text = cls(i) '指定标题,这里标题和列名相同
c.Width = wds(i) '指定列宽
c.TextAlign = HorizontalAlignment.center
Next
For Each zh As String In DataTables("考核成绩表").GetValues("考核项目") '增加分组
Dim grp As WinForm.ListViewGroup = lvw.Groups.Add()
grp.Name = zh
grp.Text = zh
For Each dr As DataRow In DataTables("考核成绩表").Select("考核项目 = '" & zh & "'","_Identify desc")
Dim r As WinForm.ListViewRow = lvw.Rows.Add() '增加一行
r.Group = dr("考核项目") '指定所属分组
r.Font = New Font("微软雅黑",12)
For Each cl As String In cls '逐列取值
If cl > ""
r(cl) = dr(cl)
End If
Next
Next
Next
lvw.ResumeRedraw() '恢复绘制
lvw.Columns("考核情况_完成时间").Text = "考核用时" '修改考"核情况_完成时间"列的标题
lvw.Columns("考核情况_最终得分").Text = "最终得分"