老师,怎么统计ListView1中Checked=true的数量?
我这样写逻辑有点问题,提示了两次,请老师看看怎么改。
If e.Form.Controls("DateTimePicker1").text <> "" Then
Dim lvw As WinForm.ListView = e.Form.Controls("ListView1")
Dim int As Integer = 0
For Each r As WinForm.ListViewRow In lvw.Rows
If r.Checked = True
int = int+1
Dim Result As DialogResult
Result = MessageBox.Show("你本次考勤的人数为:" & int & "人,确定考勤吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If Result = DialogResult.Yes Then
Dim dr As Row= Tables("实名制考勤").AddNew()
dr("姓名") = r.text
dr("日期") = e.Form.Controls("DateTimePicker1").text
dr.save
Else
End If
Else
MessageBox.show("你并没有选择任何人!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
End If
Next
Else
MessageBox.show("考勤日期不能为空!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
End If