This is a quick start article that will show how to build a SMS application in your SmartPhone with help of Compact Framework and OpenCFNET.
Create a new Visual Studio project. If you choose to build an OpenCFNET application, some references are added automatically. (I think that this is the big difference between an ordinary SmartPhone project and these kinds of projects.)
Choose to build a windows application and the platform should be SmartPhone. When you have done this a new project will be created and it's time to start build our fancy application.
But before we start building our user interface we must add an additional reference to our project. We need support for SMS. Choose Add Reference and browse through the list until you find OpenNETCF.Phone. Choose this component and click on "Select" and thereafter "OK" to add it.
Now, let's build the user interface. It is not so advanced. Put two labels and two textboxes on the form. Change the name of the first label to "Phone number" and the second to "Message". (You could enter a phone number in the first textbox if you don't want to enter it later when you run the program.) Change the name of the textboxes to textBoxPhone and textBoxMessage. The last control to add is a menu control. Add it and make one menu item with the name "Send".
Now is the time to do some programming. Double click on the menu item that you have created earlier. The code for the click event for the menu item will automatically be created for you.
This is the only code you need. In my example I use C#, but it's a no-brainer to convert it to Visual Basic.
The first command will create a new SMS object. The second row makes a SMS address containing the phone number that the user has entered in the first textbox. Be aware that the second parameter tells the method that the number should be entered as an international number. The third command does the job sending the message that is entered in the second textbox. After this we just close the SMS object and show a message that confirms the action.
Run the application
This application will not run in the emulator because we have to send SMS. This is not supported in the emulator. To run the application in the phone you have to change the device from an emulator to the "Smartphone Device". After you have done that and connected your Smartphone you press F5 to run the application. The program will now compile and be deployed to your phone.