Connecting Tech Pros Worldwide Forums | Help | Site Map

selecting a list element...

Member
 
Join Date: Oct 2008
Posts: 42
#1: Nov 21 '08
hi all,
can any one suggest me on selcting a list element?

i am displaying a list containing some items dynamically...
after displaying the content and the form holding this list, i need to select elements by pressing up/down button on the mobile phone...

at times by default i'm able to select items by clicking on the up/down buttons...
but i need a reliable solution for this...
can any one help me...

i'm using c#.net, the project is for windows mobile...

markmcgookin's Avatar
Moderator
 
Join Date: Dec 2006
Location: Northern Ireland / England
Posts: 546
#2: Nov 25 '08

re: selecting a list element...


The selected index of the item is what you need... so something like

Expand|Select|Wrap|Line Numbers
  1. this.myListBox.selectedIndex = 1;
  2.  
this may be selectedItem, items.selectedItemIndex or something similar, this is just off the top of my head

then on your buttons
Expand|Select|Wrap|Line Numbers
  1. this.myListBox.selected index = this.myListBox.SelectedIndex + 1;
  2.  
and for down

Expand|Select|Wrap|Line Numbers
  1. this.myListBox.selected index = this.myListBox.SelectedIndex - 1;
  2.  
Reply