Many thanks for that Ilya.
Ilya Tumanov [MS] wrote:
> Right, that is not obvious. IBindingList is not exactly designed to be used
> by humans directly.
>
> Here's some sample (it's in C# but should not be too hard to convert to VB):
>
> OutlookSession os = new OutlookSession();
>
>
> ContactCollection cc = os.Contacts.Items;
>
>
> Contact c;
>
>
> c = new Contact();
>
> c.FirstName = "John";
>
> c.LastName = "Doe";
>
> cc.Add(c);
>
> c = new Contact();
>
> c.FirstName = "Jane";
>
> c.LastName = "Smith";
>
>
> cc.Add(c);
>
> PropertyDescriptor pdContact =
> TypeDescriptor.GetProperties(typeof(Contact))["LastName"];
>
> // Should be something like this in VB:
>
> // Dim pdContact as PropertyDescriptor =
> TypeDescriptor.GetProperties(GetType(Contact)).Item("LastName");
>
> int smithIndex = cc.Find(pdContact, "Smith");
>
>
> --
> Best regards,
>
> Ilya
>
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
> *** Want to find answers instantly? Here's how... ***
>
> 1. Go to
>
http://groups-beta.google.com/group/microsoft.public.dotnet.framework.compactframework?hl=en > 2. Type your question in the text box near "Search this group" button.
> 3. Hit "Search this group" button.
> 4. Read answer(s).
>
> <lansalot@gmail.com> wrote in message
> news:1139961124.296392.273500@z14g2000cwz.googlegroups.com...
> > Hi
> >
> > I'm struggling with searching the Contacts on my PocketPC with
> > VS2005/.NET cf2 and hope someone can help please.
> >
> > Specifically, the documentation for the Find method is a bit lacking
> > (to my eyes). You can see it here:
> >
> >
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/mobilesdk5/html/M_Microsoft_WindowsMobile_PocketOutlook_PimItemCollection_Find_1_917213a7.asp
> >
> > I have no idea what I should be passing in as some sort of valid
> > PropertyDescriptor, nor the Key for that matter.
> >
> > Can someone please help with a little example, say the simplest "find
> > contact for surname = 'smith'" sort of thing?
> >
> > My nearest try was:
> >
> > Dim o As New OutlookSession
> > criteria = "[LastName] = " & ControlChars.Quote & "Smith" &
> > ControlChars.Quote
> > MsgBox(o.Contacts.Items.Find(c.Properties("LastName"), criteria))
> >
> > But obviously that's nowhere near right.
> >
> > Also tried MsgBox(o.Contacts.Items.Find(c.Properties("LastName"),
> > "Smith"))
> >
> > Nothing found. And it's there alright. I've seen how to use the
> > Restrict method, but that's not really the appropriate one to be using
> > so I guess I should learn to do it properly.
> >
> > Thanks in advance for any help.
> >