Wednesday, January 6, 2010

Introduction to LINQ

A simple introduction to LINQ using C#.Net.

Watch it:

Working with XML

The video shows how to load an xml in datagrid and makes updates in the xml sheets wirting codes in

watch it

Working with EXCEL sheets

This video shows how to add a table from a database to an excel sheet and update the table contents by writing just 3 lines of codes in C#.Net.

watch it :

Monday, October 19, 2009

Retrieving inbox from mobile

For retrieving inbox details from a GSM mobile phone is not simple as the sending messages from phone using PC with the help of a AT Commands. Here we need to check whether your phone store your messages in the SIM memory or phone memory. We need to alter our messages according to the storage type of the messages.

Here are the example in the case of storing the messages inside the inbox.

AT Command

AT // For checking phone connected
AT+CMGF=1 // Setting message format
AT+CSCS="PCCP437" // Setting charset
AT+CPMS="SM" // Selecting sim message storage
AT+CMGL="ALL" // Reading all inbox messages

Function for reading message collection

public ShortMessageCollection ReadSMS(SerialPort port)

// Set up the phone and read the messages
ShortMessageCollection messages = null;

#region Execute Command
// Check connection
ExecCommand(port,"AT", 300, "No phone connected");
// Use message format "Text mode"
ExecCommand(port,"AT+CMGF=1", 300, "Failed to set message format.");
// Use character set "PCCP437"
ExecCommand(port,"AT+CSCS=\"PCCP437\"", 300, "Failed to set character set.");
// Select SIM storage
ExecCommand(port,"AT+CPMS=\"SM\"", 300, "Failed to select message storage.");
// Read the messages
string input = ExecCommand(port,"AT+CMGL=\"ALL\"", 5000, "Failed to read the messages.");

#region Parse messages
messages = ParseMessages(input);

catch (Exception ex)
throw new Exception(ex.Message);

if (messages != null)
return messages;
return null;


Saturday, September 26, 2009

Sample projects using C#.Net , Communication GSM modem with PC

In this blog I like to tell you about the communication between the PC and GSM modem in mobile phone. Iam creating this sample application in C#.Net and SQL Server , for communicating with GSM mobile phone we need to know how to execute AT commands in Windows Hyper-terminal.

Microsoft HyperTerminal

Microsoft HyperTerminal is a small program that comes with Microsoft Windows. You can use it to send AT commands to your mobile phone or GSM/GPRS modem. It can be found at Start -> Programs -> Accessories -> Communications -> HyperTerminal. If you cannot find it and you are using Windows 98, then probably you have not installed it. You can go to Control Panel -> Add/Remove Programs -> Windows Setup tab -> Communications list box item -> Details button to install MS HyperTerminal.
for more details follow this web site :

Hypertreminal communicates directly with the modem /mobile connected and instructs the modem. It also gives responses back as OK or error etc. But if we have a application where we need to send SMS after a specific set of actions, then hypertreminal is not useful, since it requiers manual typing. You need to select the COM port on which modem/mobile is connected.(port can be serial port for modem or USB port for mobile).

Sending through hyper-terminal

AT+CMGW="+cell number",129
> Your sms message content [
press ctrl Z ]

Sending SMS through GSM modem.

First let us examine how to send SMS through a GSM mobile phone in C#.Net.

1. Connect the phone to the PC and Install modem driver software , for eg Nokia pc suite
2. Refer the AT commands for communicating with GSM Modem.
3. Test these commands through windows hyperterminal.
4. Find the port address of the COM port of the modem from device manager.
5. Use these port address in our application for sending SMS.

Creating code in C#

Create new project and add new class SMSCOMMS.cs .
In the class import class library Threading, ComponentModel, IO.Ports

Click here to view the whole class file.

Iam now try to develop the receiving the list of inbox items , sent items and trash in a mobile phone.


AT Commands