Tech
Forums
Jobs
Books
Events
Live
Interviews
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
0
Reply
view sms messages from sim card in modem
Marvin kakuru
Feb 11 2016 12:15 PM
406
Reply
kindly below is the code i am trying to use but keep getting messagebox"There is no message in SIM" yet the sim card has got over 20 sms's
private void btnReadSMS_Click(object sender, EventArgs e)
{
try
{
//count SMS
int uCountSMS = objclsSMS.CountSMSmessages(this.port);
if (uCountSMS > 0)
{
#region Command
string strCommand = "AT+CMGR=\"ALL\"";
if (this.rbReadAll.Checked)
{
strCommand = "AT+CMGL=\"ALL\"";
}
else if (this.rbReadUnRead.Checked)
{
strCommand = "AT+CMGL=\"REC UNREAD\"";
}
else if (this.rbReadStoreSent.Checked)
{
strCommand = "AT+CMGL=\"STO SENT\"";
}
else if (this.rbReadStoreUnSent.Checked)
{
strCommand = "AT+CMGL=\"STO UNSENT\"";
}
#endregion
// If SMS exist then read SMS
#region Read SMS
//.............................................. Read all SMS ....................................................
objShortMessageCollection = objclsSMS.ReadSMS(this.port, strCommand);
foreach (ShortMessage msg in objShortMessageCollection)
{
textBox1.Text += msg.Message;
ListViewItem item = new ListViewItem(new string[] { msg.Index, msg.Sent, msg.Sender, msg.Message });
item.Tag = msg;
lvwMessages.Items.Add(item);
}
#endregion
}
else
{
lvwMessages.Clear();
//MessageBox.Show("There is no message in SIM");
this.statusBar1.Text = "There is no message in SIM";
}
}
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
0
)
Next Recommended Forum
Develop a Multi UI Application from Start to Finish with C#
delete MSMQ Queue through bat file