c# sending sms from computer

Posted by I__ on Stack Overflow See other posts from Stack Overflow or by I__
Published on 2010-06-12T01:00:24Z Indexed on 2010/06/12 1:02 UTC
Read the original article Hit count: 293

Filed under:
|
|

i have this code:

private SerialPort port = new SerialPort("COM1", 115200, Parity.None, 8, StopBits.One);

                  Console.WriteLine("Incoming Data:");
                  port.WriteTimeout = 5000;
                  port.ReadTimeout = 5000;
                  // Attach a method to be called when there is data waiting in the port's buffer
                  port.DataReceived += new SerialDataReceivedEventHandler(port_DataReceived);

                  // Begin communications
                  port.Open();
                  #region PhoneSMSSetup
                  port.Write("AT+CMGF=1\r\n");
                  Thread.Sleep(500);
                  port.Write("AT+CNMI=2,2\r\n");
                  Thread.Sleep(500);
                  port.Write("AT+CSCA=\"+4790002100\"\r\n");
                  Thread.Sleep(500);
                  #endregion
                  // Enter an application loop which keeps this thread alive
                  Application.Run();

i got it from here:

http://www.experts-exchange.com/Programming/Languages/C_Sharp/Q_22832563.html

i have a new winforms empty application:

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;

namespace WindowsFormsApplication1
{

    public partial class Form1 : Form
    {

        public Form1()
        {
            InitializeComponent();
        }


        private void Form1_Load(object sender, EventArgs e)
        {

        }
    }
}

can you please tell me:

  1. where exactly would i paste the code?
  2. how do i get the code to run?

i am sending AT COMMANDS to my cell phone that is attached to the computer

© Stack Overflow or respective owner

Related posts about c#

Related posts about text