Foxtable(狐表)用户栏目专家坐堂 → ListView1中Checked=true的数量


  共有1800人关注过本帖树形打印复制链接

主题:ListView1中Checked=true的数量

帅哥哟,离线,有人找我吗?
cd_tdh
  1楼 | QQ | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:狐精 帖子:3106 积分:20733 威望:0 精华:0 注册:2016/3/28 16:57:00
ListView1中Checked=true的数量  发帖心情 Post By:2019/4/3 16:39:00 [只看该作者]

老师,怎么统计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

 


 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2019/4/3 17:47:00 [只看该作者]

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
        End If
    Next
    If Int = 0 Then
        MessageBox.show("你并没有选择任何人!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
    Else
        Dim Result As DialogResult
        Result = MessageBox.Show("你本次考勤的人数为:" & int & "人,确定考勤吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
        If Result = DialogResult.Yes  Then
            For Each r As WinForm.ListViewRow In lvw.Rows
                If r.Checked = True
                    Dim dr As Row= Tables("实名制考勤").AddNew()
                    dr("姓名") = r.text
                    dr("日期") = e.Form.Controls("DateTimePicker1").text
                    dr.save
                   
                End If
               
            Next
        End If
    End If
Else
    MessageBox.show("考勤日期不能为空!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
End If

 回到顶部