ListView1控件中的值列出
如何判断ListView1控件的列中存在空值?
------------------------------------------
id 姓名 号码
1 AA 005
2 BB 002
3 CC 001
4 GG
5 KK
6 FF 008
7 JJ 111
-------------------------------------------
如上图中如何判断号码有空值存在?????
如何判断ListView1控件的列中存在空值?
------------------------------------------
id 姓名 号码
1 AA 005
2 BB 002
3 CC 001
4 GG
5 KK
6 FF 008
7 JJ 111
-------------------------------------------
如上图中如何判断号码有空值存在?????
msgbox "第一行 第三列为空"
for y= 1 to listview1.listitem(x).subitems.count
if(ListView1.ListItem(x).SubItems(y) = "") then print "为空"
next
next
Dim i As Integer
For i = 1 To Me.ListView1.ListItems.Count
Set itmx = Me.ListView1.ListItems(i)
'检测首行
If itmx.Text = "" Then
Debug.Print "第1列第" & i & "行为空"
End If
If itmx.SubItems(1) = "" Then
Debug.Print "第2行第" & i & "行为空"
End If
If itmx.SubItems(2) = "" Then
Debug.Print "第3行第" & i & "行为空"
End If
Next i
End SubPrivate Sub Form_Load()
Dim i As Integer With Me.ListView1
.View = lvwReport
.GridLines = True
.ColumnHeaders.Add , , "aaa"
.ColumnHeaders.Add , , "bbb"
.ColumnHeaders.Add , , "ccc" For i = 1 To 100
Set itmx = Me.ListView1.ListItems.Add(, , i) If i Mod 2 = 0 Then
itmx.SubItems(1) = i
itmx.SubItems(2) = ""
Else
itmx.SubItems(1) = ""
itmx.SubItems(2) = i
End If
Next i
End With
End Sub