Click here to Skip to main content
15,881,938 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Sir,,
Please give me the code for reading messeges from multiple sim.
Posted
Comments
Raul Iloc 28-Apr-14 1:21am    
You should give more details about what you want, and did you try (some code) until to put the question, in order to can help you!
Rini Rajan 28-Apr-14 1:41am    
Thank you for ur responds..
in my code i have two com ports.. when i run my code the first device read the messeges correctly and give the count also read the second device messages..
my code is
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Microsoft.VisualBasic;
using System.Net;
using System.IO.Ports;
using System.Security.Permissions;

namespace Eben_Longcode_Manager
{
public partial class main : Form
{
public main()
{
InitializeComponent();
}
#region Public Variables
public int baurd_rate, thread_exit = 0, msg_read = 0, msg_rcvd = 0, msg_read1 = 0;

public string port_name;
string msg1,
mob = "", mob1 = "";
bool isbgw = true;
bool isbgw1 = true;
SerialPort port = new SerialPort();
Eben_Longcode_Manager.Classes.clsSMS objclsSMS = new Eben_Longcode_Manager.Classes.clsSMS();
Eben_Longcode_Manager.Classes.ShortMessageCollection objShortMessageCollection = new Eben_Longcode_Manager.Classes.ShortMessageCollection();
#endregion
private void main_Load(object sender, EventArgs e)
{
#region Display all available COM Ports
try
{
string[] ports = SerialPort.GetPortNames();
foreach (string port in ports) // Add all port names to the combo box:
{
this.cmb_port.Items.Add(port);
this.cmb_port1.Items.Add(port);
this.cmb_port2.Items.Add(port);
}
}
catch (Exception)
{

throw;
}

#endregion
}

private void btn_connect_Click(object sender, EventArgs e)
{
try
{
port_name = cmb_port.Text;
baurd_rate = Convert.ToInt32(cmb_baurd.Text);
this.port = objclsSMS.OpenPort(port_name, baurd_rate, Convert.ToInt32("8"), Convert.ToInt32("300"), Convert.ToInt32("300"));
btn_start.Enabled = true; //enable start button
btn_disconnect.Enabled = true; //enable disconnect button
btn_connect.Enabled = false; //disable connect button
if (mob == "")
setnumber();
lbl_status.Text = "Device connected at port " + port_name;
}
catch (Exception)
{

throw;
}

}

private void btn_Connect1_Click(object sender, EventArgs e)
{
try
{
port_name = cmb_port1.Text;
baurd_rate = Convert.ToInt32(cmb_baurd1.Text);
this.port = objclsSMS.OpenPort(port_name, baurd_rate, Convert.ToInt32("8"), Convert.ToInt32("300"), Convert.ToInt32("300"));
btn_Start1.Enabled = true;
btn_Disconnect1.Enabled = true;
btn_Connect1.Enabled = false;
if (mob1 == "")
setnumber();
lbl_status1.Text = "Device connected at port " + port_name;
}
catch (Exception)
{

throw;
}

}
public void setnumber()
{
try
{
string myValue = Interaction.InputBox("Please provide the mobile number", "Mobile Number", mob, 100, 100);// If user has clicked Cancel, set myValue to defaultValue
if (myValue == "")
myValue = mob;
else
mob = myValue;
if (tbdevice1.Focus())
{
lbl_number.Text = mob;
}
if (tbdevice2.Focus())
{
lbl_devicenumber.Text = mob;
gggustafson 28-Apr-14 9:33am    
You are duplicating posts. Take the code that you want to add to your question and insert it into the question through the "Improve question" button. Always surround your code with <pre lang="cs">...</pre> tags. That will format your code. Then delete this comment.

Also note that your code is truncated. There is a limit on the length of comments. No such limit exists in Questions or Answers.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900