View Single Post
  #1 (permalink)  
Old 02-25-2008, 04:54 AM
thartung's Avatar
thartung thartung is offline
Newbie
 
Join Date: Feb 2008
Location: Colorado Springs, CO
Posts: 4
Default Lookup Contacts using a listbox


I am trying to learn how to create a listbox that is populated by the PIM contacts, and being a noob, I am a bit confused. I have found some examples that show how to add the contacts collection and so forth, but I am not sure how to extact the selected item in the list. So far this is what I have:

form2.show
sendlist.New1
ContactsCollection.New1("Contacts")
ContactsCollection.SortItems("LastName",false) 'sorts the contacts using the last name field.
For i = 0 To ContactsCollection.Count - 1
Contact.Value = ContactsCollection.GetItem(i)
listbox1.Add(Contact.LastName & " " & Contact.firstName) 'Add the contact's first and last name to ListBox1.
Next
Contact.Value = ContactsCollection.GetItem(listbox1.SelectedIndex)

It errors out on the last line. Error says object reference not set

Thank you for any help provided
Reply With Quote