?
Solved

Databound Listbox - Item Selection Problem

Posted on 2014-02-17
6
Medium Priority
?
789 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
[X]
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
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 2000 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
Interactive Way of Training for the AWS CSA Exam

An interactive way of learning that will help you visualize core concepts so that you can be more effective when taking your AWS certification exam.  Built for students by a student to help them understand the concepts that they are being taught.

 

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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

762 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