|
-
Oct 30th, 2007, 03:51 AM
#1
Thread Starter
Hyperactive Member
[2005] E-mailing Contents of Listview
Hello,
I wonder if anyone can help me please ?
I have a listview which contains several rows of data relating to several employees.
I'd like to know if it is possible to e-mail each employee the rows relating to them.
So for example :
Row 1 = Joe Bloggs / ABC / DEF / GHI
Row 2 = Fred Bloggs / 123 / 456 / 789
Row 3 = Joe Bloggs / XYZ / XYZ / XYZ
Joe would get an e-mail containing 2 rows and Fred would get an e-mail containing 1 row.
Is this possible ?
If so, where would I begin ?
Thanks.
-
Oct 30th, 2007, 06:01 AM
#2
Re: [2005] E-mailing Contents of Listview
One way to do it would be to use a Dictionary perhaps. Then when sending the email output the value into the body of the email text and send. Loop through each person to send a new email. This might give you a start:
vb Code:
Dim myRecords As New Dictionary(Of String, List(Of String))
If Not myRecords.ContainsKey("Joe Bloggs") Then 'If Name doesn't exist then add it to dictionary Key
myRecords.Add("Joe Bloggs", New List(Of String)) 'Add name
myRecords("Joe Bloggs").Add("ABC / DEF / GHI") 'Add value
End If
If myRecords.ContainsKey("Joe Bloggs") Then 'If name already exists then simply
myRecords("Joe Bloggs").Add("XYZ / XYZ / XYZ") 'add new value
End If
'Set up your email and in the body text you would
'Loop through the contents per Key (person you send it to)
'output the content for that particular key into body of email
For Each itm As KeyValuePair(Of String, List(Of String)) In myRecords
For i As Integer = 0 To itm.Value.Count - 1
MessageBox.Show(itm.Key & " " & itm.Value.Item(i)) 'Show name and any values associated in collection
Next
Next
edit I should add that this would assume you loop through your ListView and pass each of the values in the columns into the values above so you wouldn't obviously need to literally pass the value Joe Bloggs etc...
Last edited by stimbo; Oct 30th, 2007 at 06:07 AM.
-
Oct 30th, 2007, 10:41 AM
#3
Thread Starter
Hyperactive Member
Re: [2005] E-mailing Contents of Listview
Thanks Stimbo - I'll have a look into that.
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
|