vb.net中,怎么把listview1的数据筛选之后放到listview2,不能删除listview1的数据
对listview1筛选,某些列相同,然后是一列的数据相加,怎么写代码这样写有错误LvPartDetail1.Items.Add(Trim(StrModelpart))L...
对listview1筛选,某些列相同,然后是一列的数据相加,怎么写代码
这样写有错误
LvPartDetail1.Items.Add(Trim(StrModelpart))
LvPartDetail1.Items(i).SubItems.Add(Trim(Strstockno))
LvPartDetail1.Items(i).SubItems.Add(Trim(StrQty))
LvPartDetail1.Items(i).SubItems.Add(xPartCodeSID)
LvPartDetail1.Items(i).SubItems.Add(xStockSID)
' LVWOgb.Items(I).SubItems.Add(xTrayMultiple)
LvPartDetail1.Items(i).SubItems.Add(StrEcCode)
SpiF023.Value = xTrayMultiple
ChkONE = True '第一包开启
Next
For i As Integer = 0 To LvPartDetail1.Items.Count
For j As Integer = 0 To i - 1
If LvPartDetail1.Items.Item(i).SubItems(0).Text = LvPartDetail1.Items.Item(j).SubItems(0).Text Then
If LvPartDetail1.Items.Item(i).SubItems(1).Text = LvPartDetail1.Items.Item(j).SubItems(1).Text Then
If LvPartDetail1.Items.Item(i).SubItems(2).Text = LvPartDetail1.Items.Item(j).SubItems(2).Text Then
LvPartDetail.Items.Item(i).SubItems(5).Text = Val(LvPartDetail1.Items.Item(i).SubItems(5).Text) + Val(LvPartDetail1.Items.Item(j).SubItems(5).Text)
LvPartDetail.Items.Add(LvPartDetail1.Items(i))
End If
end if
end if 展开
这样写有错误
LvPartDetail1.Items.Add(Trim(StrModelpart))
LvPartDetail1.Items(i).SubItems.Add(Trim(Strstockno))
LvPartDetail1.Items(i).SubItems.Add(Trim(StrQty))
LvPartDetail1.Items(i).SubItems.Add(xPartCodeSID)
LvPartDetail1.Items(i).SubItems.Add(xStockSID)
' LVWOgb.Items(I).SubItems.Add(xTrayMultiple)
LvPartDetail1.Items(i).SubItems.Add(StrEcCode)
SpiF023.Value = xTrayMultiple
ChkONE = True '第一包开启
Next
For i As Integer = 0 To LvPartDetail1.Items.Count
For j As Integer = 0 To i - 1
If LvPartDetail1.Items.Item(i).SubItems(0).Text = LvPartDetail1.Items.Item(j).SubItems(0).Text Then
If LvPartDetail1.Items.Item(i).SubItems(1).Text = LvPartDetail1.Items.Item(j).SubItems(1).Text Then
If LvPartDetail1.Items.Item(i).SubItems(2).Text = LvPartDetail1.Items.Item(j).SubItems(2).Text Then
LvPartDetail.Items.Item(i).SubItems(5).Text = Val(LvPartDetail1.Items.Item(i).SubItems(5).Text) + Val(LvPartDetail1.Items.Item(j).SubItems(5).Text)
LvPartDetail.Items.Add(LvPartDetail1.Items(i))
End If
end if
end if 展开
1个回答
展开全部
ListView2.Items.Add(ListView1.Items(0).Clone)
追问
那个改变的值怎么写进listview2, 就是怎么取出listview中的值,是两列的值相加,然后写进listview2
追答
add后直接可以修改。
像你代码中的这句
LvPartDetail.Items.Item(i).SubItems(5).Text = Val(LvPartDetail1.Items.Item(i).SubItems(5).Text) + Val(LvPartDetail1.Items.Item(j).SubItems(5).Text)
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询