Friday, June 3, 2011

Mobile Application With C#

Developing mobile applications has never been easier than before. With the advent of Microsoft’s .NET technology, we are given a choice of language to use that we are familiar with. One of the most fascinating and powerful language is C#. Unlike C++ which is designed to be a low-level platform-neutral object oriented language, C# was designed to be a somewhat higher-level component-oriented language.


To begin, we will be using Visual Studio .NET for this project. On the “New Project” window, choose Smart DeviceApplication. See Figure



Once chosen, the Smart Device Application Wizard will appear. For this project we will be selecting Pocket PC as our target platform while our type of project will be a windows application.

Once we have chosen our options on the “Smart Device Application Wizard”, we’ll notice that the form displayed is somewhat smaller (246 x 302 pixels) than that of the usual windows form. For obvious reasons, mobile devices has a smaller screen than those of the desktop and notebook PC’s


Now let’s put in some controls in our form.
First, let’s drag a label control and set its size to 216 x152 pixels . For a final touch let us put in a button control on our form.


Let’s put in the finishing touches to our form.


elect our form, Click on “View Code” in the Solution Explorer.
On our codes, let’s set the text properties of our two controls.

public Form1()

{
//
// Required for Windows Form Designer support
//
InitializeComponent();

//
// TODO: Add any constructor code after InitializeComponent call
//
this.label1.Text = "This is my first .NET mobile application";
this.button1.Text = "OK";
}

That’s it! We are ready to go and test our application. Press F5 to compile and see it run on Visual Studio’s emulator.









No comments:

Post a Comment