如何根据条件记录来自 datagridview 的更改 [VB.NET]

问题描述

嗨,我有一个包含 1000 行用户信息的 datagridview,每 3 分钟更新一次。

我需要为第一个 datagridview 中的每个人记录对不同 datagridview 的更改。

我尝试过使用 CellFormatting。

日志基于两个条件:在线/离线

用户在线时,datagridview 的新行日期/时间 |姓名 |登录

用户离线时,datagridview 的新行日期/时间 |姓名 |退出

enter image description here

这就是我迄今为止所尝试的

如果你至少能告诉我怎么做我会很感激。

 Private Sub DataGridView1_CellFormatting(sender As Object,e As DataGridViewCellFormattingEventArgs) Handles DataGridView1.CellFormatting
    For Each row As DataGridViewRow In DataGridView1.Rows
        If row.Cells(3).Equals("Online✅") Then
            DataGridView2.Rows.Add(Date.Now.ToString("dd:MM:yy hh:mm:ss tt"),row.Cells(2),"Login")
        Else
            DataGridView2.Rows.Add(Date.Now.ToString("dd:MM:yy hh:mm:ss tt"),"Exit")
        End If
    Next
End Sub

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)