notification popup when new data is added to the DataGridview vb.net

Viewed 28

I am building a standalone application with MS access as DB, When I update a data from any of the application the same will be replicated to all the other machines datagrid view for that I have LoadData() but when a new ROW is added I am not getting the notification popup. I really Appreciate a help in advance. I am not a pro in coding.

Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
        LoadData()
    End Sub

Private Sub dgvNotify_RowsAdded(sender As Object, e As DataGridViewRowsAddedEventArgs) Handles dgvNotify.RowsAdded
    Dim targetRow = Me.dgvNotify.Rows.Cast(Of DataGridViewRow)().OrderByDescending(Function(r) r.Cells("ID").Value).FirstOrDefault
    If targetRow IsNot Nothing Then
        targetRow.Selected = True
        New_Notification()
    End If

End Sub

Private Sub Form1_FormClosing(sender As Object, e As FormClosingEventArgs) Handles MyBase.FormClosing
    Me.WindowState = FormWindowState.Minimized
    Me.Visible = False
    e.Cancel = True
End Sub

Private Sub New_Notification()
    NotifyIcon1.BalloonTipTitle = "New Important Notification"
    NotifyIcon1.BalloonTipText = "Open the notification application to check the notifications" & vbCrLf & "If you have any question reachout to ops leads:)"
    NotifyIcon1.ShowBalloonTip(3000)
End Sub
0 Answers
Related