Accessing SIM card from C#

M

Mustafa Rabie

Hi All,

the following article talks about how to get info from the SIM card. I
downloaded the sample, used the Phone.cs in an application, and everytime i
try to access the card i get "Can't read the service provider"

here's the code i am using:
using Microsoft.Wireless;

//application inits etc

private void button1_Click(object sender, System.EventArgs e)

{

string szOwnerNumber = "";

try

{

szOwnerNumber =
Microsoft.Wireless.Sim.GetServiceProvider();//Microsoft.Wireless.Sim.GetPhon
eNumber().ToString();

textBox1.Text = szOwnerNumber;

}

catch (Exception exp)

{

textBox1.Text = exp.Message;

}

}

is there something that i am missing or something?

I am using T-Mobile XDA-I upgraded to Windows Mobile 2003 (T-Mobile build)

thanks

mustafa
 
M

Mustafa Rabie

Hi Peter,

that's the link for the article
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetcomp/html/netcfphoneapi.asp

i have tried using the OpenNETCF.Phone.Sim but i always get an error
whenever i run the application, and click the button that calls the
SIM.OwnNumbers i get the following error
System.TypeLoadException in System.Windows.Forms.dll, addicional information
: unable to load the type OpenNETCF.Phone.Sim.Sim from OpenNETCF.Phone
Namespace, Version=0.5.1627.32363, Culture=Neutral, PublicKeyToken=null.

private void button1_Click(object sender, System.EventArgs e)

{

textBox1.Text = "test";

try

{

OpenNETCF.Phone.Sim.Sim mySIM = new Sim();

textBox1.Text = mySIM.OwnNumbers.ToString();

}

catch(Exception exp)

{

textBox1.Text = exp.Message;

}

// textBox1.Text = mySMS.GetPhoneNumber();

}

and actually that happens with almost all the OpenNETCF.Phone functions,
SMS, SIM everything. I posted msgs on their forum but no reply, if you can
point me to the problem i'd really appreciate it.

Thanks a lot for your help
Mustafa Rabie
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top