Passing email data (array,collection,table)
Passing email data (array,collection,table)
Passing email data (array,collection,table)
Passing email data (array,collection,table)
Passing email data (array,collection,table)
Passing email data (array,collection,table) Passing email data (array,collection,table) Passing email data (array,collection,table) Passing email data (array,collection,table) Passing email data (array,collection,table) Passing email data (array,collection,table) Passing email data (array,collection,table) Passing email data (array,collection,table)
Passing email data (array,collection,table) Passing email data (array,collection,table)
Passing email data (array,collection,table)
Go Back  Xtreme Visual Basic Talk > > > Passing email data (array,collection,table)


Reply
 
Thread Tools Display Modes
  #1  
Old 10-18-2005, 04:41 PM
Chatelain's Avatar
Chatelain Chatelain is offline
Centurion
 
Join Date: Jan 2002
Posts: 102
Default Passing email data (array,collection,table)


Hi,
I'm googled out!
How to pass email data from one function to another in a windows service. For Example: From, To, CC, Date, Subject, Body, ReplyTo, Attachment path, etc. Arrays, collections, tables....I just don't know which one is a good fit.

The service gets new email from a pop3 server and creates support cases using the data in the email (From, To, ...).

I would appreciate help on how to store and pass that data between functions, etc. Email size will be minimal but there will be numerous email to deal with.
Thank you,
Aaron

Last edited by Chatelain; 10-18-2005 at 10:27 PM. Reason: word missing
Reply With Quote
  #2  
Old 10-19-2005, 03:04 AM
Sonreir's Avatar
Sonreir Sonreir is offline
Contributor
 
Join Date: Jul 2004
Location: Hampshire, England
Posts: 540
Default

I'd create a structure or a storage class. Then you can set the appropriate variables or properties and just pass the object as a whole, rather than worry about all the variables seperately.
Reply With Quote
  #3  
Old 10-19-2005, 02:32 PM
Chatelain's Avatar
Chatelain Chatelain is offline
Centurion
 
Join Date: Jan 2002
Posts: 102
Default

Sonreir - Thanks for your reply!
In a storage class, how can I setup a property to be an array? For example, if the property was AttachmentPath, I would need it to be an array since there might be multiple attachments and I also would need it dynamic. Is any of this possible or can you suggest another way of doing it? Thanks again!
Reply With Quote
  #4  
Old 10-19-2005, 02:35 PM
wayneph's Avatar
waynephPassing email data (array,collection,table) wayneph is offline
Web Junkie

Retired Moderator
* Expert *
 
Join Date: Apr 2004
Location: D/FW, Texas, USA
Posts: 8,393
Default

Quote:
Originally Posted by Chatelain
Sonreir - Thanks for your reply!
In a storage class, how can I setup a property to be an array? For example, if the property was AttachmentPath, I would need it to be an array since there might be multiple attachments and I also would need it dynamic. Is any of this possible or can you suggest another way of doing it? Thanks again!
If you need a Dynamic Array, I would suggest using an ArrayList. That is what it is designed for.
__________________
-- wayne, MSSM Retired
> SELECT * FROM users WHERE clue > 0
0 rows returned
Reply With Quote
  #5  
Old 10-19-2005, 02:38 PM
Chatelain's Avatar
Chatelain Chatelain is offline
Centurion
 
Join Date: Jan 2002
Posts: 102
Default

Thanks wayneph! Dumb question - can I have an ArrayList as a property in my Email class? This class would have other properties like from, subject, body, etc.
Reply With Quote
  #6  
Old 10-19-2005, 02:42 PM
wayneph's Avatar
waynephPassing email data (array,collection,table) wayneph is offline
Web Junkie

Retired Moderator
* Expert *
 
Join Date: Apr 2004
Location: D/FW, Texas, USA
Posts: 8,393
Default

yep.

Just make sure that in your constructor you create an instance of your class.

Code:
Public myList as ArrayList Public Sub New() myList = New ArrayList End Sub
__________________
-- wayne, MSSM Retired
> SELECT * FROM users WHERE clue > 0
0 rows returned
Reply With Quote
  #7  
Old 10-20-2005, 09:06 AM
Chatelain's Avatar
Chatelain Chatelain is offline
Centurion
 
Join Date: Jan 2002
Posts: 102
Default

Thanks again wayneph!
Perhaps someone can help me on this...I'm getting an error, " 'Set' parameter must have the same type as the containing property."
Code:
    Public Property eTo() As ArrayList
        Get
            Return _To.Clone()
        End Get
        Set(ByVal Value As Object)  ''Set' parameter must have the same type as the containing property.
            _To.Add(Value)
        End Set
    End Property
Of course what I'm wanting to do is pass in an item to tack on the end of the arraylist. Is this possible?
Aaron
Reply With Quote
  #8  
Old 10-20-2005, 09:38 AM
Sonreir's Avatar
Sonreir Sonreir is offline
Contributor
 
Join Date: Jul 2004
Location: Hampshire, England
Posts: 540
Default

The property as you have it will need this line changed:
Code:
Set(ByVal Value As Object)
to this:
Code:
Set(ByVal Value As ArrayList)
Because you declared the property as an ArrayList, not an Object.

You may want to use a function instead. Something like this:
Code:
Public Function eTo(ByVal Optional something as Object = Nothing) as ArrayList If Not something is Nothing Then _To.Add(something) End If Return _To.Clone() End Function
Reply With Quote
  #9  
Old 10-20-2005, 10:12 AM
wayneph's Avatar
waynephPassing email data (array,collection,table) wayneph is offline
Web Junkie

Retired Moderator
* Expert *
 
Join Date: Apr 2004
Location: D/FW, Texas, USA
Posts: 8,393
Default

Quote:
Originally Posted by Chatelain
Of course what I'm wanting to do is pass in an item to tack on the end of the arraylist. Is this possible?
Personally, I wouldn't use the "Set" property. (The Get is great, I had created it as a Public Variable becaue I was being Lazy.) In order to leave the Get and take the others off you'll have to change the property to ReadOnly which isn't a bad thing. It just means that you've got other methods to modify the data.

What I would do is create a Public Sub that adds the item.
Code:
Public Sub addTo (EmailAddress as String) _To.Add(EmailAddress) End Sub

Then when you're calling it, you would have something like this:
Code:
Dim msg as New myEmailClass 'This calls the constructor msg.addTo("user@domain.com") 'This will add the address to the To Array List

Basically you can create as many Subs as you need. addTo, addCC, addAttachmentPath, etc...
__________________
-- wayne, MSSM Retired
> SELECT * FROM users WHERE clue > 0
0 rows returned
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Passing email data (array,collection,table)
Passing email data (array,collection,table)
Passing email data (array,collection,table) Passing email data (array,collection,table)
Passing email data (array,collection,table)
Passing email data (array,collection,table)
Passing email data (array,collection,table) Passing email data (array,collection,table) Passing email data (array,collection,table) Passing email data (array,collection,table) Passing email data (array,collection,table) Passing email data (array,collection,table) Passing email data (array,collection,table)
Passing email data (array,collection,table)
Passing email data (array,collection,table)
 
Passing email data (array,collection,table)
Passing email data (array,collection,table)
 
-->