473,691 Members | 2,476 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.It ems.Add(Me.lstA vailable.Select edItem)
Me.lstSSPicsID. Items.Add(Me.ls tAvailableID.It ems.Item(Me.lst Available.Selec t
edIndex))
'change move button enabled
Me.btnMove.Enab led = False
'deselect item ***this bit dont work***
lstSSPics.Selec tedIndex = -1
lstSSPicsID.Sel ectedIndex = -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 7148
* "GJP" <ga***@gMYSECON DNAME4397.fsnet .co.uk> scripsit:
Me.btnMove.Enab led = False
'deselect item ***this bit dont work***
lstSSPics.Selec tedIndex = -1
lstSSPicsID.Sel ectedIndex = -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***@gMYSECON DNAME4397.fsnet .co.uk> scripsit:
Me.btnMove.Enab led = False
'deselect item ***this bit dont work***
lstSSPics.Selec tedIndex = -1
lstSSPicsID.Sel ectedIndex = -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***@gMYSECON DNAME4397.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.microso ft.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***@gMYSECON DNAME4397.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.microso ft.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
3870
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 is shown and able to select. If the user selects Option2, then Field2 is not shown. I can have the hidden-field working properly. However, after the user selected Field1-Option1 and selected an Option on Field2, but cannot deselect the option on Field2 if change mind on Field1 selection. ...
1
5427
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 when I call the form's bindingcontext.AddNew, the combobox is not always showing an empty value. Does anyone know how to deselect all items in a combobox in a way that always works fine?
4
2354
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 Listbox2//Textbox2 contains list of all items selected
7
13629
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 any way that we can deselect that value. I tried with document.form_Name.ListBox_Name.options.selected =
2
11415
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, it surprisingly selected all the options. I tried another option like menu.options.removeAttribute("selected");
1
6529
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 varItem In Me!lb_test_property.ItemsSelected Me!lb_test_property.ItemsSelected = ######## Next varItem End If i want to know the code for the ### marked area Thanks in advance
1
6827
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 select/deselect all checkbox at the top of the column and be able to select.deselect all items that I have found. I am using C#.Net Thanks in advance for this
1
4595
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 = wx.ListBox(self, style=wx.LB_MULTIPLE) self.Bind(wx.EVT_LISTBOX, self.select_dev, self.devlist) to create this box, but don't know how to implement self.select_dev
0
1353
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 prevent an item from being deselected if no other item is going to be selected? Thanks -- Brent
0
8531
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8791
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6457
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5813
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4322
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4550
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2965
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2227
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
1952
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.