Wednesday, February 10, 2010

Retrieve Contacts in .net compact framework developing window mobile Application

First Add two namespaces to the form

using Microsoft.WindowsMobile.PocketOutlook;
using Microsoft.WindowsMobile.Telephony;

Make objects of Contact Class

private OutlookSession _outlooksession;
private Contact _contactselected;

Madea method to populate contacts from device into your own application e.g. i take it in listbox

private void IntializeListBox()
{
this.listBox1.DataSource = null;
this.listBox1.DataSource = _outlooksession.Contacts.Items;
this.listBox1.DisplayMember = "FileAs";
this.listBox1.ValueMember = "ItemId";

}

Call this method in form constructor

public Second()
{
_outlooksession = new OutlookSession();
InitializeComponent();
this.IntializeListBox();
}

When you run the application listbox will show the contacts which are stored in device.

Tuesday, February 9, 2010

Fetch value from a particular cell of Datagrid in .net compcat farmework in developing Window Mobile Application

Step 1 : Made an object of datagridcell.
DataGridCell currentcell;
Step 2 : Take a string to store the data which is in the cell you want to select.
String currentcelldata;
Step 3 : Assign the data of datagrid current cel too the string.
currentcell = dataGrid1.CurrentCell; // Determing the currentcell of
datagid.
currentcelldata = (String)dataGrid1[currentcell.RowNumber, currentcell.ColumnNumber];
// Assigning data .Now the adat of currentcell is in currentcelldata.

Monday, February 1, 2010

Fetch Image from url in .net Compact Framework

HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(getmdthumb.Url);
myRequest.Method = "GET";
HttpWebResponse myResponse = (HttpWebResponse)myRequest.GetResponse();
System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(myResponse.GetResponseStream());
myResponse.Close();
picturebox1.image = bmp; // assigning image to picturebox