Wednesday, August 20, 2008

.Net Compact Frame work and List View

 

Let discuss some property and methods:

 

To Enable selecting row

lstView.FullRowSelect= true;

 

To Set columns to List view

this.ItemName = new System.Windows.Forms.ColumnHeader();
this.ItemQty = new System.Windows.Forms.ColumnHeader();
this.ItemPrice = new System.Windows.Forms.ColumnHeader();

//Then add these columns to list

this.lstView.Columns.Add(this.ItemName);
this.lstView.Columns.Add(this.ItemQty);
this.lstView.Columns.Add(this.ItemPrice);

 

 

To add Items to List View

//First create list view items

//Add Data To list
ListViewItem Item1 = new ListViewItem(this.items.Text);
Item1.SubItems.Add(this.qty.Text);
Item1.SubItems.Add(item_sellPrice.ToString());

//then add this item to list

lstView.Items.Add(Item1);

 

//To get items of list view

for(int i=0;i<lstView.Items.Count;i++)
{

  ItemName  =lstView.Items[i].Text;

   ItemQty  = lstView.Items[i].SubItems[1].Text;

  ItemPrice  = lstView.Items[i].SubItems[2].Text;

}

 

I wish u got what i mean

 

Thanks dear and wish u comment on my post

No comments:

Post a Comment