Public Class frmEmailBenachrichtigung
    Dim LIST As VERAG_PROG_ALLGEMEIN.cEmailBenachrichtigungList = Nothing
    Sub New(kundennr, art)

        ' Dieser Aufruf ist für den Designer erforderlich.
        InitializeComponent()
        LIST = New VERAG_PROG_ALLGEMEIN.cEmailBenachrichtigungList(kundennr, art)
        ' Fügen Sie Initialisierungen nach dem InitializeComponent()-Aufruf hinzu.

    End Sub
   
    Private Sub frmEmailBenachrichtigung_Load(sender As Object, e As EventArgs) Handles Me.Load
        For Each l In LIST.LIST
            If l.eb_cc Then
                dgvEmailCC.Rows.Add(l.eb_EMail)
            ElseIf l.eb_bcc Then
                dgvEmailBCC.Rows.Add(l.eb_EMail)
            Else
                dgvEmail.Rows.Add(l.eb_EMail)
            End If
        Next
        dgvEmail.ClearSelection()
        dgvEmailCC.ClearSelection()
        dgvEmailBCC.ClearSelection()
    End Sub

    Private Sub btnOK_Click(sender As Object, e As EventArgs) Handles btnOK.Click
        LIST.CLEAR()
        For Each r In dgvEmail.Rows
            If r.cells(0).value <> "" Then
                If Not cProgramFunctions.IsValidEMail(r.cells(0).value) Then
                    MsgBox("Die E-Mail Adresse '" & r.cells(0).value & "' hat ein falsches Format.")
                    Exit Sub
                End If
                LIST.ADD(r.cells(0).value)
            End If
        Next
        For Each r In dgvEmailCC.Rows
            If r.cells(0).value <> "" Then
                If Not cProgramFunctions.IsValidEMail(r.cells(0).value) Then
                    MsgBox("Die E-Mail Adresse '" & r.cells(0).value & "' hat ein falsches Format.")
                    Exit Sub
                End If
                LIST.ADD(r.cells(0).value, True)
            End If
        Next
        For Each r In dgvEmailBCC.Rows
            If r.cells(0).value <> "" Then
                If Not cProgramFunctions.IsValidEMail(r.cells(0).value) Then
                    MsgBox("Die E-Mail Adresse '" & r.cells(0).value & "' hat ein falsches Format.")
                    Exit Sub
                End If
                LIST.ADD(r.cells(0).value, , True)
            End If
        Next
        If LIST.SAVE() Then
            Me.Close()
        End If
    End Sub

    Private Sub dgvEmail_Leave(sender As Object, e As EventArgs) Handles dgvEmail.Leave, dgvEmailCC.Leave, dgvEmailBCC.Leave
        sender.clearselection()
    End Sub
End Class