I am new to C# having inherited a program that controls an antenna rotor through an RS-232 port. The command which must be sent to the rotor controller is in the form
"W aaa eee" where W is the command, aaa is a 3 digit the azimuth and eee is a 3 digit elevation for the antenna. So, aaa & eee can be any number between 0 and 360.
My problem is - if I want to move to 10, I need to type in 010 and pass 010 over RS232 port. Right now the program drops the leading zero/zeros.
How do I send a number with the leading zeros?? Any help would be wonderful. Many thanks in advance.
|
Newbie Member
|
|
| 12Mar2010,10:37 | #2 |
|
You can use the custom format string. Please try this:
int a = 10; a.ToString("000"); then you will get "010". Hope it helps ![]() ------------------------------ Judy Garland Free Live Chat Software |
|
Newbie Member
|
|
| 13Mar2010,06:36 | #3 |
|
Thank you very much. I thought it would be something easy to do.
|

