|
-
Jul 13th, 2004, 09:50 AM
#1
Thread Starter
New Member
converting an arraylist to an array...
i'm somewhat new to vb, but i am writing this code using vb.net and in the process of learning stumbled across an arraylist
i tried converting the arraylist to an array using
dim a as array
a = mailbody.toarray()
and then attempted to print out the array on a email
message.body = string.join(vbnewline, a)
somehow this code isn't working and i can't figure out how, any help would be gladly appreciated ^^
-
Jul 13th, 2004, 09:59 AM
#2
What's not working about it? Some sort of run time error, or a compile error?
Help me to help you.
Help me to help you.
Help me to help you.
Help me to help you.
Help me to help you.
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Jul 13th, 2004, 10:06 AM
#3
Thread Starter
New Member
well heres the whole code, but i'm not sure how to put it in vb format on this forum... <-- newbie
and when i debug it gives me a system.invaldidcastexception
Public Sub sender(ByRef mailbody As ArrayList)
Dim a As Array
Dim message As System.Web.Mail.MailMessage = New System.Web.Mail.MailMessage
Dim NumberEmail As Integer
'Dim errorlinenumber As Integer
Try
For NumberEmail = 1 To projectnum - 1
'message.To = "[email protected]"
message.To = fformstorage(NumberEmail)
message.From = "[email protected]"
'note to self: edit sender line later
'i'm not sure what the server is called yet so i'm calling it "server" for now
message.Subject = "code error"
message.BodyFormat = MailFormat.Text
'all this other commented out material are here just for test/debugging purposes only
'message.Body = ("wow IT WORKED!")
'For errorlinenumber = 1 To sp.stringnumber
a = mailbody.ToArray()
message.Body = String.Join(vbNewLine, a)
Try
'SmtpMail.SmtpServer = "server"
SmtpMail.Send(message)
Catch ehttp As System.Web.HttpException
Console.WriteLine(ehttp.Message)
Console.WriteLine("Here is the full error message")
Console.Write(ehttp.ToString())
End Try
Next
Catch e As System.Exception
'display text of uknown error
Console.WriteLine("unknown exception occured ", e.Message)
Console.WriteLine("Here is the full error message")
Console.WriteLine(e.ToString())
End Try
End Sub
-
Jul 14th, 2004, 03:06 AM
#4
Hyperactive Member
I assume this is falling over at the
Code:
a = mailbody.ToArray()
line...?
If so, try this:-
Let me know how you get on...
"I'm Brian and so is my Wife"
-
Jul 14th, 2004, 04:48 AM
#5
PowerPoster
Originally posted by ultimia
well heres the whole code, but i'm not sure how to put it in vb format on this forum... <-- newbie
Hi,
Click on the "faq" tag at the top of the forum and go to the third section for full formatting instructions.
Taxes
The more I learn about VB.NET the more I like dBaseIII Plus
The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.
-
Jul 14th, 2004, 07:45 AM
#6
Frenzied Member
i thought i'd post this to help you with another vb.net feature:
you have a comment that says 'note to self:edit sender line later
you can use a 'token' to mark this in your TASKS. try this:
'todo edit sender line later
this will make it show up in your task view and you can double click on that task and go straight to that comment. no more searching for buried comments
-
Jul 14th, 2004, 11:36 AM
#7
Thread Starter
New Member
wow thanks guys for the tips and advice. I ended up doing
a = mailbody.ToArray(Type.GetType("System.String"))
message.Body = String.Join(vbNewLine, a)
and got it through that way. Thanks for the advice though ^^
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|