Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / September 2007

Tip: Looking for answers? Try searching our database.

Array and Email issue/question

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
sjsean - 08 Sep 2007 06:53 GMT
The page I am using works fine when just using hand entered values in
the page itself ie objMM.To = "someone@someplace.com"

The problem I am having is I can't seem to "translate" the array I
have of values into a string that would be useable for the .Body
portion.  Does anyone have suggestions or recommendations of an
article I could read?

dim cartArray
dim i

cartArray=session("cartArray")

i = cartArray(0,0)

objMM.Body = ???

Again any help is appreciated.

S
Mark Rae [MVP] - 08 Sep 2007 10:55 GMT
> Again any help is appreciated.

What information is contained in cartArray...?

Signature

Mark Rae
ASP.NET MVP
http://www.markrae.net

Alexey Smirnov - 08 Sep 2007 14:11 GMT
> The page I am using works fine when just using hand entered values in
> the page itself ie objMM.To = "some...@someplace.com"
[quoted text clipped - 16 lines]
>
> S

you can use For-Each loop, or LBound/UBound for iterating the contents
of an array

Dim i As Integer
Dim s As String

For i = LBound(cartArray) To UBound(cartArray)
s = s & cartArray(i) & vbCrLf
Next

objMM.Body = s

----------------------

Dim cartItem as String
Dim s As String

For Each cartItem in cartArray
s = s & cartItem & vbCrLf
Next

objMM.Body = s
sjsean - 09 Sep 2007 00:10 GMT
> > The page I am using works fine when just using hand entered values in
> > the page itself ie objMM.To = "some...@someplace.com"
[quoted text clipped - 41 lines]
>
> - Show quoted text -

I hopefully tried what was suggested and got the following error when
trying to process:

BC30471: Expression is not an array or a method, and cannot have an
argument list.

Line 15: for h = 0 to 13
Line 16:
Line 17: msg = msg & cartArray(h,i) & vbCrLf  <---- problem line
Line 18:
Line 19: Next

code from page is:

<% @Import Namespace="System.Web.Mail" %>
<% @LANGUAGE="VBScript" Debug="true" %>
<%

dim i as integer
dim h as integer
dim cartMaxUsed as integer
dim cartArray as string
dim msg as string

cartMaxUsed = session("cartMaxUsed")
cartArray = session ("cartArray")

for i = 0 to cartMaxUsed
for h = 0 to 13

msg = msg & cartArray(h,i) & vbCrLf

Next

Next

'Create an instance of the MailMessage class

Dim objMM As MailMessage = New MailMessage()

and so forth with mail message settings.

cartMaxUsed is total number of items in cart
there are 14 field items I have collected for each cart item.

Thanks for the advice.

sean
Alexey Smirnov - 09 Sep 2007 13:34 GMT
> BC30471: Expression is not an array or a method, and cannot have an
> argument list.

It's because you declared a string and not an array:

dim cartArray as string

An array has to be declared as:

dim cartArray() as string

Declare multi-dimensional array by separating the dimensions with
commas:

dim cartArray(,) as string

Then you can use the ReDim statement to declare the size of the
array:

ReDim cartArray(13, cartMaxUsed)

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.