PC Review


Reply
Thread Tools Rate Thread

Add an Arraylist to Arraylist?

 
 
rdi
Guest
Posts: n/a
 
      5th Apr 2004
I posted this previously--but don't know if it actually posted. So I'm
trying again. Sorry if it IS a double post.

TIA
===================================
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


--

RDI

(remove the exclamation from the email address)


 
Reply With Quote
 
 
 
 
rdi
Guest
Posts: n/a
 
      5th Apr 2004
Well I figured it out on my own. In the class definitions, I needed to have
"New ArrayList" instead of just ArrayList.

Thanks for looking.

--

RDI

(remove the exclamation from the email address)

"rdi" <rdi!@writeme.com> wrote in message
news:(E-Mail Removed)...
> I posted this previously--but don't know if it actually posted. So I'm
> trying again. Sorry if it IS a double post.
>
> TIA
> ===================================
> 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
>
>
> --
>
> RDI
>
> (remove the exclamation from the email address)
>
>



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Thread-safety: Change property of items in arraylist versus removingitems from the arraylist Curious Microsoft Dot NET 2 6th Aug 2008 12:36 PM
How to access ArrayList values inside another ArrayList? Pavel Maly Microsoft C# .NET 6 30th Oct 2006 01:46 PM
arraylist inside an arraylist for datagrid, gridview rjl Microsoft C# .NET 4 13th Apr 2006 07:32 PM
ArrayList(ICollection) constructor & overriden ArrayList.AddRange(). Sylvain Microsoft C# .NET 1 4th Jun 2005 01:19 AM
a class inherited from ArrayList, is saved to ViewState, why the type of the object read from ViewSate is not the class, but the parent, ArrayList leal ting Microsoft ASP .NET 0 29th Dec 2003 07:08 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:27 PM.