Welcome Guest Search | Active Topics | Members | Log In | Register

How to set selected item ? Options
compvis
Posted: Monday, April 12, 2010 7:52:32 AM
Rank: Newbie

Joined: 4/12/2010
Posts: 1
Points: 3
Hi,

I want to set index for selected item to an item but i could not. I only can read selected item index.

My goal is:

myLisbox.SelectedIndex = 10; //or any value in range of lisbox.Items.Count()
LidorSystems Support
Posted: Monday, April 12, 2010 8:01:50 AM

Rank: Administration

Joined: 6/10/2005
Posts: 637
Points: 1,365
You can do this by using SetChildIndex method from Items collection. Here is how to set and item to have index value of 10:

Code:
this.listBox1.Items.SetChildIndex(item, 9);


After that select the item:

Code:
item.Selected = true;


Users browsing this topic
Guest


Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Main Forum RSS : RSS

Powered by Yet Another Forum.net version 1.9.0 (NET v2.0) - 10/10/2006
Copyright © 2003-2006 Yet Another Forum.net. All rights reserved.
This page was generated in 0.090 seconds.