[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Databound Listbox - Item Selection Problem

Posted on 2014-02-17
6
Medium Priority
?
836 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 45

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 45

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
Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

 

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 45

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
In real business world data are crucial and sometimes data are shared among different information systems. Hence, an agreeable file transfer protocol need to be established.
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses

834 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