Prev: WM6.5 registry values
Next: The UK Embedded Masterclass 2010 - 6th and 11th May Cambridge & Reading
From: James hotmail on 8 Jan 2010 13:08 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
|
Pages: 1 Prev: WM6.5 registry values Next: The UK Embedded Masterclass 2010 - 6th and 11th May Cambridge & Reading |