C# Listbox keeps resetting to first selection

Posted on 2009-04-23
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

    Author Comment

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

    Expert Comment

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

    Author Comment

    Nope. All the events are the auto-written events that Studio adds by default.
    LVL 5

    Accepted Solution

    what field is your listbox bind to? primary key?

    Author Comment

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

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Join & Write a Comment

    Introduction                                                 Was the var keyword really only brought out to shorten your syntax? Or have the VB language guys got their way in C#? What type of variable is it? All will be revealed.   Also called…
    Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    729 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