Reading and sending works fine on hyperterminal. What i want is to read sms and output it on a text box. I wrote this code, am I doing it right? I am not that experienced with c#. I think the correct method is use event handler but how to do it? Thanks..
Code://read sms private void button3_Click(object sender, EventArgs e) { if (this.serialPort1.IsOpen) { serialPort1.BaseStream.Flush(); string a = "sm"; string b = "all"; //this.serialPort1.Write("AT+CPMS=\"" + a + "\"\r\n"); // this.serialPort1.Write("AT+CPMS=SM\r\n"); // this.serialPort1.Write("AT+CMGF=1\r\n"); //this.serialPort1.Write("AT+CSCS=\"PCCP437\""); //this.serialPort1.Write("AT+CPMS=\"" + a + "\"\r\n"); this.serialPort1.Write("AT+CMGR=2\r"); //this.serialPort1.Write("AT+CMGL=\"" + b + "\"\r\n"); textBox5.Text = this.serialPort1.ReadExisting(); MessageBox.Show("\nMessage Was Read\n", "Information"); } else { MessageBox.Show("\nSerial Port Is Not Open\n", " ERROR "); } }



LinkBack URL
About LinkBacks


