How insert one contact in the sim of pda

  • Thread starter Thread starter V
  • Start date Start date
V

V

Hello, my name is carlos and I develop a application that work whit
the sim of the pda. The SO is Windows Mobile 2003 Phone Edition.

I try to insert one contact in the sim but the next method don't work.
The metode don't return any exception, but don't insert the contact in
the sim. I debbuging the application and I have seen that
phonebookEntry.Text and phonebookEntry.Address remains target
(phonebookEntry.Text = "").

I don't know because this happens, I hope that somebody can say to me
since it becomes.

Code:
Private Sub miAfegirContacteSim_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles miAfegirContacteSim.Click
Try
Dim sim2 As OpenNETCF.Phone.Sim.Sim = New
OpenNETCF.Phone.Sim.Sim
Dim phonebook As OpenNETCF.Phone.Sim.Phonebook =
sim2.Phonebook
Dim phonebookEntry As New OpenNETCF.Phone.Sim.PhonebookEntry


phonebookEntry.AddressType =
OpenNETCF.Phone.AddressType.International
phonebookEntry.Plan =
OpenNETCF.Phone.Sim.NumberPlan.Telephone
phonebookEntry.Text = "Carles"
phonebookEntry.Address = "937979797"

If (phonebook.Count < phonebook.Capacity) Then
Dim i As Integer = CType(sim2.Phonebook,
System.Collections.IList).Add(phonebookEntry)
End If
sim2.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub

PD. Sorry but my english is very bad :P (I can write also in spanish
or catalan)
 
The code in the OpenNETCF.Phone.Sim namespace does not support inserting
records. It allows you to read and delete only. I wrote it many years ago
and never got around to updating it. You'll have to add this functionality
yourself, you could start with the SDF source code as it has most of the
structures and p/invokes you will need.

Peter

--
Peter Foot
Device Application Development MVP
www.peterfoot.net | www.inthehand.com

wrote in message
news:[email protected]...
 
Back
Top