R
rdi
I have 3 classes:
mailBox, mailFilter & mailFilterSet
I then have an arraylist. Each element in the array is of type mailBox (variable name is mbox). One item of the mailbox class is an arraylist named filterSet. The intended purpose is for this arrayList to contain type mailFilterSet elements. The mailFilterSet class contains a string (the name of the filter set) and an arraylist--which is intened to contain mailFilter elements.
'This works fine <= Create the mbox in array position 1.
dim i as integer = 0
mbox.Add(New mailbox())
'Then when I try to create the first element in the filter set array, it fails and gives
'an unhandled exception of type 'system.NullReferenceException".
'Additional variable or With block variable not set.
mbox.(i).filterSet.add(new mailFilterSet)
The class definitions are below.
TIA
Public Class mailbox
Public mbox As String
Public acct As String
Public fromName As String
Public fromAddress As String
Public replyAddress As String
Public ReplyMessage As String
Public ReplyAttach As String
Public sender As String
Public forwardAddress As String
Public forwardMessage As String
Public forwardAttach As String
Public sendReply As Boolean = False
Public sendForward As Boolean = False
Public replyIncludeOriginal As Boolean = True
Public forwardIncludeOriginal As Boolean = True
'0 = As Attachment
'1 = In Brackets
'2 = Unchanged
Public replyIncludeOriginalMethod As Integer = 0
Public forwardIncludeOriginalMethod As Integer = 0
Public filterSet As ArrayList
End Class
Public Class mailFilterSet
Public filterName As String
Public filter As ArrayList
End Class
Public Class mailFilter
'andor:
'2 = n/a
'1 = And
'0 = Or
Public andor As Integer
'field:
'0 = To:
'1 = From:
'2 = Reply:
'3 = Subject
'4 = Message
Public field As Integer
'TYPE:
' 0 => = <= Equal
'1 => != <= Not Equal
'2 => *= <= Ends With
'3 => =* <= Begins With
'4 => *=* <= Contains
'5 => !*=* <= Doesn't Contain
Public type As Integer
Public content As String
End Class
mailBox, mailFilter & mailFilterSet
I then have an arraylist. Each element in the array is of type mailBox (variable name is mbox). One item of the mailbox class is an arraylist named filterSet. The intended purpose is for this arrayList to contain type mailFilterSet elements. The mailFilterSet class contains a string (the name of the filter set) and an arraylist--which is intened to contain mailFilter elements.
'This works fine <= Create the mbox in array position 1.
dim i as integer = 0
mbox.Add(New mailbox())
'Then when I try to create the first element in the filter set array, it fails and gives
'an unhandled exception of type 'system.NullReferenceException".
'Additional variable or With block variable not set.
mbox.(i).filterSet.add(new mailFilterSet)
The class definitions are below.
TIA
Public Class mailbox
Public mbox As String
Public acct As String
Public fromName As String
Public fromAddress As String
Public replyAddress As String
Public ReplyMessage As String
Public ReplyAttach As String
Public sender As String
Public forwardAddress As String
Public forwardMessage As String
Public forwardAttach As String
Public sendReply As Boolean = False
Public sendForward As Boolean = False
Public replyIncludeOriginal As Boolean = True
Public forwardIncludeOriginal As Boolean = True
'0 = As Attachment
'1 = In Brackets
'2 = Unchanged
Public replyIncludeOriginalMethod As Integer = 0
Public forwardIncludeOriginalMethod As Integer = 0
Public filterSet As ArrayList
End Class
Public Class mailFilterSet
Public filterName As String
Public filter As ArrayList
End Class
Public Class mailFilter
'andor:
'2 = n/a
'1 = And
'0 = Or
Public andor As Integer
'field:
'0 = To:
'1 = From:
'2 = Reply:
'3 = Subject
'4 = Message
Public field As Integer
'TYPE:
' 0 => = <= Equal
'1 => != <= Not Equal
'2 => *= <= Ends With
'3 => =* <= Begins With
'4 => *=* <= Contains
'5 => !*=* <= Doesn't Contain
Public type As Integer
Public content As String
End Class