I am working on a project that requires an sms to be received and the contents extracted by my C# application.
I am using the GSMcomm library to communicate with a telit EZ-10 GSM modem connected to my computer.
New message notifications are enabled, hence the modem sends a command(containing the location of the new sms) to the PC whenever a new SMS is received.
I am able to receive the SMS fine but i cannot extract the required sms content. I receive the following error during the foreach statement:
"NullReferenceException was unhandled by user code
Object reference not set to an instance of an object."
While debugging, the received sms does not show in the "sms" textbox and the exception does not explicitly occur. The exception only occurs when I set a breakpoint at the foreach statment and then tell the debugger to execute the next statement . The
exception occurs at this line: SmsPdu smsrec = message.Data;
Form Code follows:
View Complete Post