Contact and Property Chooser libray

agraham

Expert
Licensed User
Longtime 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.
 

Attachments

  • ChooseContactDialog1.1.zip
    12.9 KB · Views: 133
Last edited:

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
 

agraham

Expert
Licensed User
Longtime 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.

B4X:
  ...
  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
 

klaus

Expert
Licensed User
Longtime 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.
 

Attachments

  • ChooseContactDialog_Fehler_2.jpg
    ChooseContactDialog_Fehler_2.jpg
    18.3 KB · Views: 15
  • ChooseContactDialog.sbp
    584 bytes · Views: 24

agraham

Expert
Licensed User
Longtime 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.
 

klaus

Expert
Licensed User
Longtime 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.

B4X:
[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.
 

Attachments

  • ChooseContactDialog.sbp
    857 bytes · Views: 23
  • ErrorOnDevice.jpg
    ErrorOnDevice.jpg
    25.6 KB · Views: 12

agraham

Expert
Licensed User
Longtime 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.
 

konisek

Member
Licensed User
Longtime User
Can you advise how to use the propertychooser in ChooseDialog? I use the following code:
B4X:
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.
 

Attachments

  • taxi2.jpg
    taxi2.jpg
    22.5 KB · Views: 25

konisek

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

agraham

Expert
Licensed User
Longtime 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.
B4X:
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]
 

konisek

Member
Licensed User
Longtime User
I tried to change the code
B4X:
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:

konisek

Member
Licensed User
Longtime User
Still not sure, it gives the same error:BangHead:
B4X:
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
 

konisek

Member
Licensed User
Longtime User
Hm, it resulted in:
ChooseDialog.RequiredProperties(Data())
Error description:
Syntax Error


Finally I succeded with
ChooseDialog.RequiredProperties = Data()
Thank you.:)
 
Top