Solved

Databound Listbox - Item Selection Problem

Posted on 2014-02-17
6
727 Views
Last Modified: 2014-02-17
I have a winform with a listbox databound to a single column (EmailName) of an Access table via a tableadapter. The listbox SelectionMode is set to MultiSimple and the ValueMember is set to "EmailName". The listbox fills correctly and I have coded (lboxEmailName.ClearSelected()) so no items are selected on form load .

The problem - When I select an item that is not the first item on the list, the first item changes to the item selected.

For example: There are three names in the listbox in the following order; Moe, Larry, Curly. If I select Larry, then first name on the list (Moe), changes to Larry. Also, I can't deselect the first name on the list as long as another name is selected.

I have no experience with listboxes, I just need to have a listbox that will allow the user to make a single or multiple selection from a short list of names.

Can someone help?
0
Comment
Question by:Tim313
  • 3
  • 3
6 Comments
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 39864948
Do you mean you have two rows showing Larry ?

eg.
Larry
Larry
Curly
0
 

Author Comment

by:Tim313
ID: 39864953
That's correct...
0
 
LVL 44

Accepted Solution

by:
AndyAinscow earned 500 total points
ID: 39864986
This almost sounds like it is updating (modifying) the underlying data source to the list box.
Do you have any code responding to events raised by the listbox ?
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 

Author Comment

by:Tim313
ID: 39865054
No events raised by the listbox. Once the form loads, no code runs until a button (btnSend) is clicked. The changes (Moe, Larry, Curly to Larry, Larry, Curly) due to user selection occurs before the button click.
0
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 39865090
Hmmm, I don't immediately see what is going wrong.
0
 

Author Comment

by:Tim313
ID: 39865165
I found the problem, actually your "updating (modifying) the underlying data source" comment sent me to look at the Properties;(DataBindings);SelectedValue... I had that set to my tableadapter bindingsource AND the DataSource Property set to my tableadapter binding source along with the DisplayMember set to EmailName.

I cleared the Properties;(DataBindings);SelectedValue and left the DataSouce and DisplayMember as is and this seems to have cleared the conflict.

Too many late nights at the keyboard...

Thanks for you help!
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now