From: James hotmail on
Hello everyone & tgif!

I am having trouble using Find from Contacts. When the code runs, the error
is that p is nothing (NullReferenceException) ?! My search uses the "Last
Name" property which is known as "LastName" and also I have noticed
["LastName"] - have tried all 3 formats. A lot of people have said to use
the Contacts.Items and just iterate through them... this is my last resort!

While stepping through this code I noticed that the colPropDesc has a count
of 14 and these objects are of
System.ComponentModel.ReflectPropertyDescriptor. If I try and cast storage
under this type I get an error saying this type does not exist?

Dim colPropDesc As
System.ComponentModel.PropertyDescriptorCollection =
System.ComponentModel.TypeDescriptor.GetProperties(OSession.Contacts.Items)
Dim p As System.ComponentModel.PropertyDescriptor =
colPropDesc.Find("Last Name", True)
Dim index As Integer = OSession.Contacts.Items.Find(p, "Desert")
'Null Reference Exception is here!

If index <> -1 Then
MessageBox.Show("found","Desert",MessageBoxButtons.OK,MessageBoxIcon.Asterisk,MessageBoxDefaultButton.Button1)
End If


As always, any thoughts, suggestions and references are welecome!

-James