You would have to set up your default values when you declare the fields, as follows:
Imports Microsoft.VisualBasic
Imports System.Net.Mail
Public Class MailClassPrivate _attachmentCollection As AttachmentCollectionPrivate _toCollection As MailAddressCollection = GetDefaultToCollection()Private _bccCollection As MailAddressCollectionPrivate _from As MailAddress = New MailAddress(System.Configuration.ConfigurationManager.AppSettings("myFromAddress"))Public Property AttachmentCollection() As AttachmentCollectionGet
Return _attachmentCollectionEnd Get
Set(ByVal value As AttachmentCollection)_attachmentCollection = value
End Set
End Property
Public Property ToCollection() As MailAddressCollectionGet
Return _toCollectionEnd Get
Set(ByVal value As MailAddressCollection)_toCollection = value
End Set
End Property
Public Property BccCollection() As MailAddressCollectionGet
Return _bccCollectionEnd Get
Set(ByVal value As MailAddressCollection)_bccCollection = value
End Set
End Property
Public Property From() As MailAddressGet
Return _fromEnd Get
Set(ByVal value As MailAddress)_from = value
End Set
End Property
Private Function GetDefaultToCollection() As MailAddressCollectionDim theCollection As New MailAddressCollectiontheCollection.Add(System.Configuration.ConfigurationManager.AppSettings("myDefaultAddress"))Return theCollectionEnd FunctionEnd Class
==================================================
Don't forget to click "Mark as Answer" on the post that helped you.
This credits that member, earns you a point and marks your thread as Resolved so we all know you have been helped.