Programming questions
for C# in .NET
in the .cs code behind file, can i highlight (select) items in a ListBox?
i need to select items in a ListBox in the .cs file
is there a property like that?
thanks in advance
in the .cs code behind file, can i highlight (select) items in a ListBox?
i need to select items in a ListBox in the .cs file
is there a property like that?
thanks in advance
i work mostly with win32 api stuff, so dunno much about c#, but in most cases the items in a listbox should be an array. try something like this:
listbox.items[0].selected = true;
could be a bit screwed up, but to do whatever it is you're going for, you almost certainly need to access the items[] array.
listbox.items[0].selected = true;
could be a bit screwed up, but to do whatever it is you're going for, you almost certainly need to access the items[] array.
ok looks like i did have a c# tool on my system after all. you can do it by the item name like so:
listBox.SelectedItem = "your item";
or you can do it by the item's position in the array, collection, or whatever it's called in c#:
listBox.SelectedIndex = 2;
listBox.SelectedItem = "your item";
or you can do it by the item's position in the array, collection, or whatever it's called in c#:
listBox.SelectedIndex = 2;
Trending Topics
ops, i found a way 
to select all listbox items:
foreach(ListItem i in ListBox.Items)
{
i.Selected = true;
}
and i assume i can do something like this:
ListBox[i].Selected = true
to select a certain item(s) in the ListBox

to select all listbox items:
foreach(ListItem i in ListBox.Items)
{
i.Selected = true;
}
and i assume i can do something like this:
ListBox[i].Selected = true
to select a certain item(s) in the ListBox
Thread
Thread Starter
Forum
Replies
Last Post
s2kdriver80
Off-topic Talk
1
May 30, 2003 03:36 PM
mingster
Off-topic Talk
5
Apr 11, 2001 09:26 PM



