473,385 Members | 1,570 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Removing items from the "SelectedItems" in a ListBox

SelectedItems and SelectedIndices appear to be read-only, so I cannot remove
a selected item. I need to do this to synchronise the selection in my list
with the selection in other views (ie. select in another view and the
selected items in my list change).

How can I change the selected items in a list box!??
Nov 20 '05 #1
11 4319
Cor
Hi Robin,

Did you try the removeAT?
\\\\
listBox1.Items.RemoveAt(x)
///

Cor
SelectedItems and SelectedIndices appear to be read-only, so I cannot remove a selected item. I need to do this to synchronise the selection in my list with the selection in other views (ie. select in another view and the
selected items in my list change).

How can I change the selected items in a list box!??

Nov 20 '05 #2
"Robin Tucker" <id*************************@reallyidont.com> schrieb
SelectedItems and SelectedIndices appear to be read-only, so I cannot
remove a selected item. I need to do this to synchronise the
selection in my list with the selection in other views (ie. select in
another view and the selected items in my list change).

How can I change the selected items in a list box!??


mylistbox.setselected(index, true)
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #3
Dim t As ListBox.SelectedObjectCollection

t = Me.lst_Classification.SelectedItems

Could you do something like this and do a t.Add / t.Remove whatever?

-CJ

"Robin Tucker" <id*************************@reallyidont.com> wrote in
message news:bu*******************@news.demon.co.uk...
SelectedItems and SelectedIndices appear to be read-only, so I cannot remove a selected item. I need to do this to synchronise the selection in my list with the selection in other views (ie. select in another view and the
selected items in my list change).

How can I change the selected items in a list box!??

Nov 20 '05 #4
"Cor" <no*@non.com> schrieb
Did you try the removeAT?
\\\\
listBox1.Items.RemoveAt(x)
///


I think this removes the item from the listbox, not only from the list of
selected items.
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #5
True.
"Armin Zingler" <az*******@freenet.de> wrote in message
news:uD****************@tk2msftngp13.phx.gbl...
"Cor" <no*@non.com> schrieb
Did you try the removeAT?
\\\\
listBox1.Items.RemoveAt(x)
///


I think this removes the item from the listbox, not only from the list of
selected items.
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #6
Cor
Hi Armin,
mylistbox.setselected(index, true)


I think this set the selected item

To remove (deselect) is
mylistbox.setselected(index, false)

:-))))))

I give no other answer on your comment, you are right I think

:-)

Cor
Nov 20 '05 #7
Cor
> True.
I think this removes the item from the listbox, not only from the list of selected items.


I am glad you see it also CJ

:-))

Cor
Nov 20 '05 #8
"Cor" <no*@non.com> schrieb
mylistbox.setselected(index, true)


I think this set the selected item

To remove (deselect) is
mylistbox.setselected(index, false)

:-))))))


Was an example only how to call which function. (I know you know...)
--
Armin

Nov 20 '05 #9
=)

"Cor" <no*@non.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
True.

I think this removes the item from the listbox, not only from the list of selected items.


I am glad you see it also CJ

:-))

Cor

Nov 20 '05 #10
Cheers all. As so often happens, I had a Doh! moment just after posting the
question. The method isn't on the item (of course) or the item collection,
its on the list itself, so I used ListBox.SetSelectedItem(a, b). Bad design
imho ;)

"Cor" <no*@non.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
True.

I think this removes the item from the listbox, not only from the list of selected items.


I am glad you see it also CJ

:-))

Cor

Nov 20 '05 #11
I would like to point out thought I did see it, but did not make a comment
on it until AFTER Armin had.

=0
"Cor" <no*@non.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
True.

I think this removes the item from the listbox, not only from the list of selected items.


I am glad you see it also CJ

:-))

Cor

Nov 20 '05 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Alex Stevens | last post by:
I'd already posted this in microsoft.public.dotnet.framework.windowsforms and microsoft.public.dotnet.framework.windowsforms.controls to no avail so apologies for the cross-posting. Hi, I'm...
2
by: Matt Sawyer | last post by:
Hi, I'm attempting to do a drag and drop operation from one listbox to another. I have my listboxes setup with SelectionMode = MultiExtended so that I can use the shift key, cntrl key, etc. to...
13
by: Eric Schreiber | last post by:
How can i get the itemdata form each item in a mulitselect list. I made a loop but keep getting only the first value. Dim i Dim array1(100) For i = 1 To aantalrecords
2
by: tangokilo | last post by:
Hello and thanks for your help, I have the following Listbox created in VisualStudio 2003 designer, desiring to select multiple entries from that list: -------------------------------...
28
by: cjobes | last post by:
Hi all, I need to populate a listbox from a table column. The column has multiple entries of usernames and I need to pull a unique set of usernames. The table is part of an untyped Dataset that...
3
by: Richard Albrecht | last post by:
I have been trying to figure out for days on how to read values from a Bound ListBox. The listBox gets the values from an Access Table. I can read values fine for Non-Bound ListBoxes, But the...
3
by: thomasp | last post by:
Has anyone got some sample code to do drag and drop from one listbox to another listbox using VB.Net 2005. The below code works for draging and droping one at a time, but not for multiselected...
3
by: Michael Meckelein | last post by:
Hello, I run into trouble move down a selected item in a listbox. The code moving down the item is the following one: for (int j = lv.SelectedItems.Count-1; j >=0; j--) { ListViewItem...
2
by: =?Utf-8?B?TmFjaA==?= | last post by:
I am new to .net can someone teranslate the foloowing in .net Ls and Lt will be listboxes. Sub ListCpSelected(Ls As Control, Lt As Control) 'Copies selected items from one list to another Dim I...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.