I am TOTALLY stumped about why this code won't work, and it's killing
me. Can someone PLEASE look into this and show where I'm screwing up?
Here's the setup:
1. A window with 2 ListBoxes (ListBox1 and ListBox2).
2. Both ListBoxes should have 2 columns (you can make just column 0
visible in ListBox1).
In ListBox1's Open event, enter the following code:
////////////
me.addRow "All"
dim groups() as AddressBookGroup
dim group as AddressBookGroup
groups = System.AddressBook.Groups
for each group in groups
if ubound(group.Groups) >= 0 then
me.AddFolder group.name
else
me.addRow group.name
end if
me.cell(me.LastIndex,1) = group.UniqueID
next
me.listIndex = 0
////////////
In ListBox1's Change event, enter the follwoing:
////////////
Dim data, datas() as AddressBookData
Dim group, groups() as AddressBookGroup
Dim contact, contacts() as AddressBookContact
Dim i, c as Integer
ListBox2.DeleteAllRows
if me.ListIndex > 0 Then
groups = System.AddressBook.Groups
for Each group in groups
if group.UniqueID = me.Cell(me.ListIndex,1) Then
Exit
end
next
contacts = group.contacts
For i = 0 to Ubound(Contacts)
if contacts(i).FirstName = "" then
ListBox2.AddRow contacts(i).EmailAddresses
else
ListBox2.addrow contacts(i).FirstName + " " + contacts
(i).LastName
end
ListBox2.cell(i,1) = contacts(i).EmailAddresses
Next
Elseif me.ListIndex = 0 Then
Contacts = System.AddressBook.Contacts
for each contact in contacts
if me.cell(me.listindex,1) = contact.UniqueID then
exit
end if
next
data = contact.EmailAddresses
if data <> nil Then
for each Contact in contacts
ListBox2.AddRow contact.FirstName + " " + contact.LastName
ListBox2.Cell(ListBox2.LastIndex,1) = data.Value
next
End
End
////////////
When you run the project, everything will look *wonderful* except
that when you click the "All" address group, each contact's
associated email isn't being displayed.
What am I doing wrong? I'M DYING TRYNG TO FIGURE THIS OUT!
Later,
Maury
=======================================
My Website:
http://www.railheaddesign.com/
My Blog:
http://railheaddesign.blogspot.com/
My Photos:
http://www.flickr.com/photos/maurymccown/
What I'm Listening To:
http://www.last.fm/user/RAILheadDesign/
=======================================
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>