如果只有这些列是日字开头的使用if
if e.Col.Name like "日*" then
If e.text = "×" Then
……
Dim d As Date = e.Form.Controls("DateTimePicker1").Value
MessageBox.Show(d.year)
If d <> Nothing 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 Then
int = int + 1
End If
Next
If Int = 0 Then
MessageBox.show("你并没有选择任何人!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information)
Else
Dim Result As DialogResult '对话框结果
Result = MessageBox.Show("你本次到岗人数为: " & int & "人,缺勤人数为: " & int & " 人,确定考勤吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If Result = DialogResult.Yes Then
For Each r As WinForm.ListViewRow In lvw.Rows
Dim dr As DataRow = DataTables("月考勤统计A").Find("年='" & d.Year & "' And 月='" & d.Month & "' And 姓名='" & r.Text & "'")
If dr Is Nothing Then
dr = DataTables("月考勤统计A").AddNew
dr("年") = d.Year
dr("月") = d.Month
dr("姓名") = r.Text
End If
'原代码
' If r.Checked = True Then
' dr("日" & d.Day) = "√"
' Else
' dr("日" & d.Day) = "×"
' End If
'新代码 完全正确
If r.Checked = True Then
Dim dn As String = e.Form.Controls("ComboBox1").Value
If dn = "出勤√" Then
dr("日" & d.Day) = "√"
Else If dn = "病假△" Then
dr("日" & d.Day) = "△"
Else If dn = "事假☆" Then
dr("日" & d.Day) = "☆"
Else If dn = "旷工×" Then
dr("日" & d.Day) = "×"
Else If dn = "休息/" Then
dr("日" & d.Day) = "/"
Else If dn = "其他○" Then
dr("日" & d.Day) = "○"
End If
DataTables("人员信息表A").DataRow("是否登记") = True
End If
Next
DataTables("月考勤统计A").Save
End If
End If
Else
MessageBox.show("考勤日期不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information)
End If
老师,这里需要赋值,请修改一下红色代码
窗口ListView中:If r.Checked = True Then
那么, "人员信息表A"的"是否登记"逻辑列 = True
Dim lvw As
WinForm.ListView = e.Form.Controls("ListView1")
For Each r As WinForm.ListViewRow In
lvw.Rows
r.Checked = True
Next
蓝老师,这是全选代码,我想要已选代码