473,413 Members | 1,789 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,413 software developers and data experts.

passing a collection to a function

What I am doing is creating a web based email, using .net

I have finised the inbox, read, delete email etc..

Im in the process of making the "create email" or compose...

What the plan is, for people to be able to enter multiple "To:" "CC:" and "BCC:"

I have only done the "To:" field as yes, Atrax gave me the hint on how to split the emails with a ";" using split

What that did thou was place the emails into an array, which made it a pain to remove any blank emails which would cause an error...
I would always be working with strings, Below is the code that works with the "To" field
Dim arrTo(), strEmail As String
Dim j, intColCount, intEmptyColID As Integer
Dim colTo As ArrayList
Dim bolValidEmails, bolFoundInvalid As Boolean
'Dim objMsg As Object
'objMsg = Server.CreateOBject("JMail.Message")
'objMsg.Logging = true
'objMsg.Silent = true
'objMsg.From = Session("EmailAddress")
'\\\\\\\\\\\\\\\Splits the "To:" information into different emails - placing them into a collection for later use
colTo = New ArrayList
arrTo = strTo.Split(";")
For Each strEmail in arrTo
colTo.Add(trim(strEmail))
Next
'\\\\\\\\\\\\\\\Erases any empty emails out of the collection
bolValidEmails = False
bolFoundInvalid = False
intEmptyColID = -1
Do While bolValidEmails = False
For j = 0 To colTo.Count - 1
If bolFoundInvalid = False Then
If colTo(j) = "" Then
bolFoundInvalid = True
intEmptyColID = j
End If
End If
Next
If bolFoundInvalid = True Then
bolValidEmails = False
colTo.RemoveAt(intEmptyColID)
Else
bolValidEmails = True
End If
intEmptyColID = -1
bolFoundInvalid = False
Loop
'\\\\\\\\\\\\\\\Trims the Collection
colTo.TrimToSize()
What I want to do is, after I create the collection for any of the "to" "cc" and "bcc" is call that function and empty any blank emails, but I dont know how to pass the collection to the function and return the collection and continue on....

I was only using the
Dim strRandom As String
Dim objRand As New Misc
strRandom = objRand.GenerateRandNum()
objRand = Nothing
Response.Redirect("inbox.aspx?rnd=" & strRandom)

as an example of what i wanted to do as i couldn't remember the name after so many hours of programming =)...

I was asking can i use something like

Dim objChecker As New Misc
objRand.GenerateRandNum(ByRef collection name as ??)
objRand = Nothing
'continue with the rest of the email processing
do you have any code that passes a collection to a function like that? That I can look at, As I will need to be able to use the same function by multiple classes..(eg on the "reply", "Create email", "forward" class etc )

Thanks heaps

Hawk
ws abyss at info
Nov 18 '05 #1
1 1359
you can use a function with a parametere of collection as

1- dimension
private function myfunction(ByVal Arrto() As String)
or
private function myfunction(ByVal Arrto As String())

2- dimension
private function myfunction(ByVal Arrto(,) As String)
or
private function myfunction(ByVal Arrto As String(,))

Regards
Ather Ali Shaikh
"Hawk" <an*******@discussions.microsoft.com> wrote in message
news:13**********************************@microsof t.com...
What I am doing is creating a web based email, using .net

I have finised the inbox, read, delete email etc..

Im in the process of making the "create email" or compose...

What the plan is, for people to be able to enter multiple "To:" "CC:" and "BCC:"
I have only done the "To:" field as yes, Atrax gave me the hint on how to split the emails with a ";" using split
What that did thou was place the emails into an array, which made it a pain to remove any blank emails which would cause an error... I would always be working with strings, Below is the code that works with the "To" field

Dim arrTo(), strEmail As String
Dim j, intColCount, intEmptyColID As Integer
Dim colTo As ArrayList
Dim bolValidEmails, bolFoundInvalid As Boolean
'Dim objMsg As Object
'objMsg = Server.CreateOBject("JMail.Message")
'objMsg.Logging = true
'objMsg.Silent = true
'objMsg.From = Session("EmailAddress")
'\\\\\\\\\\\\\\\Splits the "To:" information into different emails - placing them into a collection for later use colTo = New ArrayList
arrTo = strTo.Split(";")
For Each strEmail in arrTo
colTo.Add(trim(strEmail))
Next
'\\\\\\\\\\\\\\\Erases any empty emails out of the collection
bolValidEmails = False
bolFoundInvalid = False
intEmptyColID = -1
Do While bolValidEmails = False
For j = 0 To colTo.Count - 1
If bolFoundInvalid = False Then
If colTo(j) = "" Then
bolFoundInvalid = True
intEmptyColID = j
End If
End If
Next
If bolFoundInvalid = True Then
bolValidEmails = False
colTo.RemoveAt(intEmptyColID)
Else
bolValidEmails = True
End If
intEmptyColID = -1
bolFoundInvalid = False
Loop
'\\\\\\\\\\\\\\\Trims the Collection
colTo.TrimToSize()
What I want to do is, after I create the collection for any of the "to" "cc" and "bcc" is call that function and empty any blank emails, but I dont
know how to pass the collection to the function and return the collection
and continue on....
I was only using the
Dim strRandom As String
Dim objRand As New Misc
strRandom = objRand.GenerateRandNum()
objRand = Nothing
Response.Redirect("inbox.aspx?rnd=" & strRandom)

as an example of what i wanted to do as i couldn't remember the name after so many hours of programming =)...
I was asking can i use something like

Dim objChecker As New Misc
objRand.GenerateRandNum(ByRef collection name as ??)
objRand = Nothing
'continue with the rest of the email processing
do you have any code that passes a collection to a function like that? That I can look at, As I will need to be able to use the same function by
multiple classes..(eg on the "reply", "Create email", "forward" class etc )
Thanks heaps

Hawk
ws abyss at info

Nov 18 '05 #2

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

Similar topics

3
by: domeceo | last post by:
can anyone tell me why I cannot pass values in a setTimeout function whenever I use this function it says "menu is undefined" after th alert. function imgOff(menu, num) { if (document.images) {...
12
by: Joel | last post by:
Hi all, Forgive me if I've expressed the subject line ill. What I'm trying to do is to call a c++ function given the following: a. A function name. This would be used to fetch a list of...
5
by: lugal | last post by:
This might be more appropriate here. I'm new to C++, coming from a background in another languages that allowed a similar solution to work (Python). I wrote the following code in C++ based on the...
39
by: Mike MacSween | last post by:
Just spent a happy 10 mins trying to understand a function I wrote sometime ago. Then remembered that arguments are passed by reference, by default. Does the fact that this slowed me down...
1
by: Larry Bird | last post by:
I want to pass a dataview to another subroutine. I've successfully created the datavew as follows: For Each CriteriaDetailRow In AlertData.AlertDS.Tables("EventCriteria").Rows Dim foundRows()...
2
by: Jacques Wentworth | last post by:
Hi I'm trying to pass a collection from a .NET DLL to a VB6 app. I get a error 13 (type mismatch) when I do so. I passed back a boolean variable without any problems, but when I try the...
11
by: John Pass | last post by:
Hi, In the attached example, I do understand that the references are not changed if an array is passed by Val. What I do not understand is the result of line 99 (If one can find this by line...
13
by: Deano | last post by:
Apparently you can only do this with one value i.e Call MyAssetLocationZoom(Me!txtLocation, "Amend data") This runs; Public Sub MyAssetLocationZoom(ctl As Control, formName As String) On...
7
by: The Doctor | last post by:
A rather elementary question, In VB5, how can I pass a variable from one form to another?
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?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.