Click here to Skip to main content
15,888,190 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
{
        int port;
        int baud;
        string status, acknowlegde;
        GsmCommMain myport;
        public Form1()
        {
            InitializeComponent();
        }
        private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
        {
        }
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                port = int.Parse(cmbport.Text);
                baud = int.Parse(cmbbaud.Text);
                myport = new GsmCommMain(port, baud);
                myport.Open();
                if (myport.IsConnected())
                {
                    status = "Connected";
                    lblstatus.Text = status;
                }
                else
                {
                    status = "Not connected";
                    lblstatus.Text = status;
                }
                myport.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
                MessageBox.Show("Invalid Connection Setting");
                status = "Not Connected";
                lblstatus.Text = status;
            }
        }
        public void showack(string acknowlegde)
        {
            lsthistory.Items.Add(acknowlegde);
            lsthistory.Items.Add("Recipent::" + lsthistory.Text + "\n");
            lsthistory.Items.Add("Message:\n");
            lsthistory.Items.Add(txtmsg.Text);
            lsthistory.Items.Add("-------------------------\n");
        }
        private void button1_Click_1(object sender, EventArgs e)
        {
            try
            {
                if (status == "Connected")
                {
                    SmsSubmitPdu pdu = new SmsSubmitPdu(txtmsg.Text, lsthistory.Text);
                    myport.Open();
                    myport.SendMessage(pdu);
                    Cursor.Current = Cursors.WaitCursor;
                    myport.Close();
                    acknowlegde = "Message Sent Sucessfuly!";
                    showack(acknowlegde);
                }
                else
                {
                    acknowlegde = "Message not sent! Retry?";
                    showack(acknowlegde);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }

but its not working:(

[edit]Code block added - OriginalGriff[/edit]
Posted
Updated 14-Jun-11 23:33pm
v2
Comments
OriginalGriff 15-Jun-11 5:34am    
"its not working"
That is not a helpful problem description. If you rang up the garage and said "its not working" and put the phone down, do you think they would be able to help you?
Use the "Improve question" widget and give us some actual information!
thatraja 15-Jun-11 10:27am    
Include the error message in your question.

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