Contact and Property Chooser libray

Discussion in 'Additional Libraries' started by agraham, Feb 11, 2009.

  1. agraham

    agraham Expert Licensed User

    This library is an extended version of a simpler one that that I produced in response to a query in another thread. Used in conjunction with the Outlook library it lets a user either choose a contact from a contact list, or choose a specific property of a pre-selected contact. There are facilities to restrict the list of contacts available to the user to a selected sub-set of the full list.

    The library requires .NET 2.0 and WM5.0 or later on the device. A dummy library to ease development on the desktop is also provided. That requires .NET 2.0 also. A help file is included but there is no demo as the use of the library really depends upon the contents of your Outlook contacts list.

    EDIT:- Version 1.1 posted. See post #7 for details.
     

    Attached Files:

    Last edited: Oct 16, 2009
  2. Aspire89

    Aspire89 Member Licensed User

    how to use the library, add the number of the selected contact in the textbox, if possible, with an example please, thanks
     
  3. agraham

    agraham Expert Licensed User

    If ChooseProperty is false (the default) then the dialog returns a contact chosen by the user that you assign to a Contact object from the Outlook library and take it from there.

    Code:
    ...
      OutlookContact.New1 
    ' only need to do it once
      ...

    If ChooseContact.Show = cOK Then ' dialog OK
      ' assign the selected contact reference to an Outlook library Contact object
     OutlookContact.Value = ChooseDialog.SelectedContact
     
    ' now all the properties should be available
      tbxFirstName.Text = OutlookContact.FirstName
      tbxLastName.Text = OutlookContact.LastName
      ....
    End If
     
  4. klaus

    klaus Expert Licensed User

    Hi Andrew,

    I am trying to use the ChooseContactDialog library.
    But I get an error message that the name Windows Mobile doesn't exist.
    What am I missing ?

    Attached the error message and the test program.

    Thank's in advance and best regards.
     

    Attached Files:

  5. agraham

    agraham Expert Licensed User

    You don't have the Windows Mobile assemblies Microsoft.WindowsMobile.Forms.dll or Microsoft.WindowsMobile.PocketOutlook.dll on your desktop as they are not part of the Compact Framework 2. Remove ChooseContactDialog.cs from your Libraries folder and use the ChooseContactDialog.dll on the device.
     
  6. klaus

    klaus Expert Licensed User

    Hi Andrew,

    Thank's, it works.

    But now I have another problem in conjunction with the Outlook.dll

    In the test program, when I try to assign the selected contact to an outlook contact I get the first message below.
    I commented out this line and put
    Contact.Value = ChooseContact.SelectedContactName
    the IDE compiles, but on the device i get an error.

    Code:
    [FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]
    [SIZE=
    2][FONT=Courier New][COLOR=#0000ff]Sub [/COLOR][/FONT][/SIZE][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]App_Start[/SIZE][/FONT]
    [SIZE=
    2][FONT=Courier New]  frmMain.Show[/FONT][/SIZE]
    [SIZE=
    2][FONT=Courier New]  Contact.New1[/FONT][/SIZE]
    [SIZE=
    2][FONT=Courier New]  ChooseContact.New1[/FONT][/SIZE]
    [SIZE=
    2][FONT=Courier New]  ChooseContact.Show[/FONT][/SIZE]
    [/SIZE][/
    FONT][FONT=Courier New][SIZE=2][COLOR=#008000][FONT=Courier New][SIZE=2][COLOR=#008000][FONT=Courier New][SIZE=2][COLOR=#008000]'  Contact.Value = ChooseContact.SelectedContact[/COLOR][/SIZE][/FONT]
    [/COLOR][/SIZE][/
    FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]  Contact.Value = ChooseContact.SelectedContactName[/SIZE][/FONT]
    [/SIZE][/
    FONT][FONT=Courier New][SIZE=2][COLOR=#008000][FONT=Courier New][SIZE=2][COLOR=#008000][FONT=Courier New][SIZE=2][COLOR=#008000]'  Label1.Text=Contact.LastName[/COLOR][/SIZE][/FONT]
    [/COLOR][/SIZE][/
    FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]End Sub[/COLOR][/SIZE][/FONT]
    [/COLOR][/SIZE][/
    FONT][/COLOR][/SIZE][/FONT]
    What am I doing wrong ?

    Best regards.
     

    Attached Files:

  7. agraham

    agraham Expert Licensed User

    Version 1.1 now posted to try to resolve the optimised compiled problem above. I had to scratch my head for a while as it was not a reference problem but seemed to be due to an unintended difference between the desktop and device libraries but I still don't understand why it produced that particular error - hopefully now fixed. It looks like I only tested in the IDE without optimised compiling, when it would work. I wonder why nobody has found this before - it had about 80 downloads? Maybe they gave up in disgust!

    Sources are no longer included as most people don't have the Outlook libraries available on their desktop that are needed for compilation. As I have Visual Studio and the WM5.0 SDK I do have then but I overlooked the fact that most don't. This is probably why Erel doesn't include the source for Outlook.dll in the libraries folder.
     
  8. Erel

    Erel Administrator Staff Member Licensed User

    That is correct.
     
  9. klaus

    klaus Expert Licensed User

    Thank you Andrew.
    It works fine now, in my test program and also in a program from JOTHA, german forum, where we encountered the problem.

    Best regards.
     
  10. konisek

    konisek Member Licensed User

    Can you advise how to use the propertychooser in ChooseDialog? I use the following code:
    Code:
    ChooseDialog.New1
    Contact.New1
    ChooseDialog.Show
    Contact.Value = ChooseDialog.SelectedContact
    Label14.Text=
    Contact.LastName & " " & Contact.FirstName
    Button8.Text=
    Contact.MobileTelephoneNumber
    That works fine but I wold like to use the Selected property as shown on the picture below instead of Contact.MobileTelephoneNumber. When I set ChooseDialog.ChooseProperty = True then it does not show the dialog at all.
     

    Attached Files:

  11. agraham

    agraham Expert Licensed User

    How about showing show the code that doesn't work instead of showing some code that does?
     
  12. konisek

    konisek Member Licensed User

    You are right. I read the help file but am not sure how to do it. I tried this:
    Code:
    ChooseDialog.New1
    ChooseDialog.ChooseProperty = 
    True
    ChooseDialog.RequiredProperties(MobileTelephoneNumber, HomeTelephoneNumber, BusinessTelephoneNumber)
    ChooseDialog.Show
    Contact.Value = ChooseDialog.SelectedContact
    Button8.Text = ChooseDialog.SelectedProperty
     
  13. agraham

    agraham Expert Licensed User

    You have no Contact in ChooseDialog.SelectedContact because you are showing it in Property mode after Newing it before selecting a Contact. With no Constact in SelectedContact the Dialog doesn't know what to do. You either need to select a contact using the dialog or assign a value to SelectedContact before using it in Property mode.
    Code:
    ChooseDialog.New1
    [COLOR=
    "Red"]ChooseDialog.Show ' First get a SelectedContact [/COLOR]
    ChooseDialog.ChooseProperty = True
    ChooseDialog.RequiredProperties(MobileTelephoneNumber, HomeTelephoneNumber, BusinessTelephoneNumber)
    ChooseDialog.Show [COLOR=
    "SeaGreen"]' now with a SlectedContact you can get a Property[/COLOR]Contact.Value = ChooseDialog.SelectedContact
    Button8.Text = ChooseDialog.SelectedProperty
    [/QUOTE]
     
  14. konisek

    konisek Member Licensed User

    I tried to change the code
    Code:
    ChooseDialog.New1
    ChooseDialog.Show
    ChooseDialog.ChooseProperty = 
    True
    ChooseDialog.RequiredProperties(MobileTelephoneNumber, HomeTelephoneNumber, BusinessTelephoneNumber)
    ChooseDialog.Show
    Contact.Value = ChooseDialog.SelectedContact
    Button8.Text = ChooseDialog.SelectedProperty
    but finally got this error msg:
    ChooseDialog.RequiredProperties(MobileTelephoneNumber, HomeTelephoneNumber, BusinessTelephoneNumber)
    Error description:
    Variable:
    main.mobiletelephonenumber was not assigned any value.
     
    Last edited: Jan 2, 2010
  15. agraham

    agraham Expert Licensed User

    RequiredProperties needs a String array parameter - see the help.
     
  16. konisek

    konisek Member Licensed User

    Still not sure, it gives the same error:BangHead:
    Code:
    Sub Globals
    Dim Data (0)
    .....
    End Sub
    Data() = Array(MobileTelephoneNumber, HomeTelephoneNumber, BusinessTelephoneNumber)
    ChooseDialog.New1
    ChooseDialog.Show
    ChooseDialog.ChooseProperty = True
    ChooseDialog.RequiredProperties(Data())
    ChooseDialog.Show
    Contact.Value = ChooseDialog.SelectedContact
    Button8.Text = ChooseDialog.SelectedProperty
     
  17. agraham

    agraham Expert Licensed User

    RequiredProperties needs a String array parameter - see the help.

    Without the quotes it looks like a set of unitialised variables!
     
  18. konisek

    konisek Member Licensed User

    Hm, it resulted in:
    ChooseDialog.RequiredProperties(Data())
    Error description:
    Syntax Error


    Finally I succeded with
    ChooseDialog.RequiredProperties = Data()
    Thank you.:)
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice