Home All Groups Group Topic Archive Search About
Author
28 Jun 2006 10:25 AM
trevor.niemack@za.syspro.com
I have got some code to attach a doc to an email but I have a few
problems with it.
The first is a syntax error on the code below:

ElseIf ListBox1.Items.ToString <> ("") Then

                Dim Counter As Integer
For Counter 0 To listbox1.Items.Count - 1

the 0 is underlined with a syntax error.

The other thing is that actual attachement, I have used the open
dialogue to select a file and it comes back with a unhandled exception
as below:

Could not find file 'C:\System.Windows.Forms.ListBox+ObjectCollection'.

Author
28 Jun 2006 10:30 AM
Herfried K. Wagner [MVP]
<trevor.niem***@za.syspro.com> schrieb:
>I have got some code to attach a doc to an email but I have a few
> problems with it.
> The first is a syntax error on the code below:
>
> ElseIf ListBox1.Items.ToString <> ("") Then

What exactly do you want to archieve?

>                Dim Counter As Integer
> For Counter 0 To listbox1.Items.Count - 1
>
> the 0 is underlined with a syntax error.

'For Counter As Integer = 0 To ListBox1.Items.Count - 1'.

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>
Author
28 Jun 2006 10:56 AM
trevor.niemack@za.syspro.com
Okay don't worry I got it to work:
Dim Counter As Integer
                Counter = ListBox1.Items.Count - 1
                Dim emailAttachment As Attachment = New
Attachment(ListBox1.Items(Counter))

I do however need some help taking various text fields and adding them
to a word template that I can create. And then add to the email going
out or maybe to the email body.