472,342 Members | 1,462 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

deselect item in list box

GJP
Hello.

I have two list boxes. One with a picture name, and one for the ID of that
picture (both coming from a database).

The user selects the name of the picture and presses a button, the picture
and the picture ID are then moved to other list boxes. This works ok, but
once this has been done, i dont want to delete the item from the origional
listbox, i just want to deselect it, but i cant seem to do this.

Here is the code for when the button is clicked:

'move items
Me.lstSSPics.Items.Add(Me.lstAvailable.SelectedIte m)
Me.lstSSPicsID.Items.Add(Me.lstAvailableID.Items.I tem(Me.lstAvailable.Select
edIndex))
'change move button enabled
Me.btnMove.Enabled = False
'deselect item ***this bit dont work***
lstSSPics.SelectedIndex = -1
lstSSPicsID.SelectedIndex = -1
'run enableAdd
enableAdd()

As you can see, i have tried getting around it by setting selectedIndex
to -1, but this does not work.

Any ideas?
Thank you in advance
Gavin.

--
Free sweets for me and you when you join
http://www.sweetcollect.com/?referer=scaredycat
---
Do something amazing give Blood
http://www.blood.co.uk
Nov 20 '05 #1
4 7023
* "GJP" <ga***@gMYSECONDNAME4397.fsnet.co.uk> scripsit:
Me.btnMove.Enabled = False
'deselect item ***this bit dont work***
lstSSPics.SelectedIndex = -1
lstSSPicsID.SelectedIndex = -1
'run enableAdd
enableAdd()

As you can see, i have tried getting around it by setting selectedIndex
to -1, but this does not work.


Set 'SelectedIndex' to -1 /twice/ for the same listbox.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #2
GJP
Thanks, ill give it a go!
--
Free sweets for me and you when you join
http://www.sweetcollect.com/?referer=scaredycat
---
Do something amazing give Blood
http://www.blood.co.uk

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:c6************@ID-208219.news.uni-berlin.de...
* "GJP" <ga***@gMYSECONDNAME4397.fsnet.co.uk> scripsit:
Me.btnMove.Enabled = False
'deselect item ***this bit dont work***
lstSSPics.SelectedIndex = -1
lstSSPicsID.SelectedIndex = -1
'run enableAdd
enableAdd()

As you can see, i have tried getting around it by setting selectedIndex
to -1, but this does not work.


Set 'SelectedIndex' to -1 /twice/ for the same listbox.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Nov 20 '05 #3
* "GJP" <ga***@gMYSECONDNAME4397.fsnet.co.uk> scripsit:
Thanks, ill give it a go!


Here it is:

BUG: ComboBox Does Not Clear When You Set SelectedIndex to -1
<URL:http://support.microsoft.com/?id=327244>

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #4
GJP
got it working. cheers.

Gav

--
Free sweets for me and you when you join
http://www.sweetcollect.com/?referer=scaredycat
---
Do something amazing give Blood
http://www.blood.co.uk
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:c6************@ID-208219.news.uni-berlin.de...
* "GJP" <ga***@gMYSECONDNAME4397.fsnet.co.uk> scripsit:
Thanks, ill give it a go!


Here it is:

BUG: ComboBox Does Not Clear When You Set SelectedIndex to -1
<URL:http://support.microsoft.com/?id=327244>

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Nov 20 '05 #5

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

Similar topics

6
by: Orchid | last post by:
I have 2 fields with Radio button Data Type, and both fields with more than one options. On Field1, I want the user to select option1, then Field2...
1
by: Christian Dokman | last post by:
Hello, When I bind a datasource to a combobox, the first item is always selected, also when I set the SelectedValue property to -1 or 0. Also...
4
by: Bill Nguyen | last post by:
I would like to be able to do the following: Listbox1/Textbox1 contains list of all items not selected item A item B item D ...
7
by: deepagulati | last post by:
Hi, I need an urgent help from you. When we dynamically genrate any list box (Select Box) it shows one default value as selected. Is there...
2
by: ahmad | last post by:
when i used the statment for(var i = 0; i < menu.length; i++) { menu.options.selected = "false"; } to deselect all the options within a list,...
1
by: dev.amit | last post by:
Hello friends Can anyone tell me how to deselect the item selected in the list box If Me!lb_test_property.ItemsSelected.Count > 0 Then For Each...
1
by: VBNovice05 | last post by:
I run a search on my database and get items that fit that search in a datagrid. There are checkboxes already for each item. I need to create a...
1
by: Bailu | last post by:
Hi, I am a newbie in wxPython and doing a program with ListBox, I want to select and deselect items in this box, I have use self.devlist =...
0
by: bscrivner | last post by:
I'm using a ListView and if the user doesn't click on an item any previous item is deselected. I cannot allow an empty selection, so how can I...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...

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.