C# Listbox keeps resetting to first selection

Posted on 2009-04-23
Medium Priority
Last Modified: 2012-05-06

This is probably very simple im sure.

I am writing a program in C# (with Studio Express 08). I have a listbox on my form that is bound to a certain table.

Whenever I select one of the elements in the ListBox, it instantly switches to selecting the first element. Not really sure why.

Any Ideas?
Question by:bkaplunovskiy
  • 3

Author Comment

ID: 24215571
I put a combo box on the form too and bound it to that table, it too resets to the first element.
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 24215944
Did you handle any of the click events for those controls? You may be overriding the selection by handling the event.

Author Comment

ID: 24216107
Nope. All the events are the auto-written events that Studio adds by default.

Accepted Solution

rendaduiyan earned 1500 total points
ID: 24222425
what field is your listbox bind to? primary key?

Author Comment

ID: 24225191
Its bound to the 'FirstName' Field of a table of Employees.

Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Question has a verified solution.

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

Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
High user turnover can cause old/redundant user data to consume valuable space. UserResourceCleanup was developed to address this by automatically deleting user folders when the user account is deleted.
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
How to fix display issue, screen flickering issue when I plug in power cord to the machine. Before I start explaining the solution lets check out once the issue how it looks like after I connect the power cord. most of you also have faced this…
Suggested Courses

616 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