Hi everyone,
How it would be possible to fix the exception in this procedure? Any help will be appreciated. Thank you!
How it would be possible to fix the exception in this procedure? Any help will be appreciated. Thank you!
Code:
Public Sub LoadEmailAddress()
Dim strRecipient As String
Dim dicRecipients As New Dictionary(Of String, String)
Dim dicCopyGroups As New Dictionary(Of String, clsGroup)
Dim MyGroup As clsGroup
Try
For Each strGroup In gdicGroups.Keys
dicRecipients.Clear()
sqlReader = GetSqlReaderForEmailAddressesNew(gConn, gdicGroups(strGroup))
While sqlReader.Read()
strRecipient = sqlReader("RecipientEmail").ToString
If strRecipient.Trim <> "" Then
If Not dicRecipients.ContainsKey(strRecipient) Then dicRecipients.Add(strRecipient, strRecipient)
End If
End While
MyGroup = gdicGroups(strGroup)
MyGroup.Recipients = dicRecipients
'***** The next line throws the exception
dicCopyGroups.Add(strGroup, MyGroup)
Next strGroup
gdicGroups = dicCopyGroups
sqlReader.Close()
Catch ex As Exception
MessageBox.Show(ex.Message & vbCr & ex.TargetSite.Name, "....", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub