Databound Listbox - Item Selection Problem

Posted on 2014-02-17
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?
Question by:Tim313
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
LVL 44

Expert Comment

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


Author Comment

ID: 39864953
That's correct...
LVL 44

Accepted Solution

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 ?
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

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.
LVL 44

Expert Comment

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

Author Comment

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!

Featured Post

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (…
In my previous article ( we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

737 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