Dim lvw As WinForm.ListView = e.Form.Controls("ListView1")
lvw.StopRedraw() '停止绘制
lvw.Groups.Clear() '清除原来的分组
lvw.Columns.Clear() '清除原来的列
lvw.Rows.Clear() '清除原来的行
lvw.Images.Clear() '清除原来的图片
lvw.View = ViewMode.Details '显示模式为详细信息
Dim cls() As String = {"产品名","长","宽","厚","主材工艺","数量"} '定义列名
Dim wds() As Integer = {160,60,60,60,200,40} '定义列宽
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) '指定列宽
Next
For Each zh As String In Tables("订单表.订单明细").GetValues("房间") '增加分组
Dim grp As WinForm.ListViewGroup = lvw.Groups.Add()
grp.Name = zh
grp.Text = zh
Next
For Each dr As DataRow In Tables("订单表.订单明细").DataRows
'Dim Key As String = dr("图标")
Dim r As WinForm.ListViewRow = lvw.Rows.Add() '增加一行
lvw.Images.AddImage(Key, Key & ".ico", Key & "48.ico") '添加代表这个国家的一对图标
'r.ImageKey = Key '指定图标键值
r.Group = dr("房间") '指定所属分组
For Each cl As String In cls '逐列取值
Select Case cl
'Case "人口","面积" '如果是人口列或面积列
'r(cl) = format(dr(cl),"#,000") '则显示千位分割符号
Case Else
r(cl) = dr(cl)
End Select
Next
Next
lvw.ResumeRedraw() '恢复绘制
---------------------------
错误
---------------------------
编译错误:“GetValues”不是“Table”的成员。
错误代码:For Each zh As String In Tables("订单表.订单明细").GetValues("房间") '增加分组
---------------------------
确定
---------------------------