473,395 Members | 1,404 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Add an Arraylist to Arraylist?

rdi
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)
Nov 20 '05 #1
1 1809
rdi
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" <rd**@writeme.com> wrote in message
news:OX*************@TK2MSFTNGP12.phx.gbl...
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)

Nov 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Alex Ting | last post by:
Hi Everybody, I have an issue about deleting an object from an arrayList. I've bounded a datagrid using this code where it will first run through all of the code in loadQuestions() and bind a...
3
by: george r smith | last post by:
I am trying to create an arrayList that contains multiple arrayLists. My code attempt is below. The question I have is how can I get away from creating another pAttribute list than can be added to...
3
by: Stephen | last post by:
I was wondering if someone can help me with an web application design problem. I have a aspx page which builds up an arraylist called addresses and outputs the values in the arraylist items to a...
6
by: gane kol | last post by:
Hi, I have a code that creates a datatable from an arraylist, but i am getting an error in casting in for (int intRow = 0; intRow < alLCPlist.Count; intRow++) { DataRow drow =...
4
by: Peter | last post by:
I run into this situation all the time and I'm wondering what is the most efficient way to handle this issue: I'll be pulling data out of a data source and want to load the data into an array so...
18
by: JohnR | last post by:
From reading the documentation, this should be a relatively easy thing. I have an arraylist of custom class instances which I want to search with an"indexof" where I'm passing an instance if the...
18
by: Sam | last post by:
Hi All I'm planing to write an application which allows users dynamically add their points (say you can add upto 30,000) and then draw xy graph. Should I use an array for my coordinate point...
6
by: fniles | last post by:
I am using VB.NET 2003 and a socket control to receive and sending data to clients. As I receive data in 1 thread, I put it into an arraylist, and then I remove the data from arraylist and send it...
3
by: Christopher H | last post by:
I've been reading about how C# passes ArrayLists as reference and Structs as value, but I still can't get my program to work like I want it to. Simple example: ...
1
by: =?Utf-8?B?SkI=?= | last post by:
Hello My pgm1 (User Interface Level) passes an empty ArrayList to pgm2 (Business Logic Level). pgm2 then calls pgm3 (Data Access Level) to populate the ArrayList. Question1: When pgm2 gets...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.