Solved

Databound Listbox - Item Selection Problem

Posted on 2014-02-17
6
711 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
Comment Utility
Do you mean you have two rows showing Larry ?

eg.
Larry
Larry
Curly
0
 

Author Comment

by:Tim313
Comment Utility
That's correct...
0
 
LVL 44

Accepted Solution

by:
AndyAinscow earned 500 total points
Comment Utility
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
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 

Author Comment

by:Tim313
Comment Utility
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
Comment Utility
Hmmm, I don't immediately see what is going wrong.
0
 

Author Comment

by:Tim313
Comment Utility
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Visual Studio installation 5 33
.net VBA word safemode 1 23
Setting runtime form location 4 18
Different Delete Messages 7 10
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

744 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

18 Experts available now in Live!

Get 1:1 Help Now