Click here to Skip to main content
15,885,979 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I m sending sms in pdu mode through flowing command, "length" is a label which shows pdu length, my code is working when I write AT+CMGS=20 or whatever the length is but i want that code take value of label insted of writing static value in code, i m using it below mention way but it is not working.

can anyone help me about how can i write in code if i m doing in wrong way?
C#
string recievedData = ExecCommand(port, "AT", 500000, "No phone connected");
recievedData = ExecCommand(port, "AT+CMGF=0", 500000, "Failed to set message format.");
string command = "AT+CMGS=\""+ length +" \"";
recievedData = ExecCommand(port, command, 500000, "Failed to accept phoneNo");
command = p1 + char.ConvertFromUtf32(26) + "\r";
recievedData = ExecCommand(port, command, 5000, "Failed to send message");
Posted
Updated 21-Apr-12 3:37am
v3
Comments
[no name] 21-Apr-12 9:38am    
You mean you want to know how to change
string command = "AT+CMGS=\""+ length +" \"";
to this
string command = "AT+CMGS=\""+ label1.Text +" \"";
?

I want that length displays in label1.text will work as length of pdu, in this part of command at+cmgs=<whatever the="" length="">, actualy in my code pdu legth is calculated and show on label1.
 
Share this answer
 
IF your question is correctly worded, which I am not too sure about, AND length is actually a label an not some other variable, then you would need to change
C#
string command = "AT+CMGS=\""+ length +" \"";

to
C#
string command = "AT+CMGS=\""+ length.Text +" \"";
 
Share this answer
 

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