Trouble with combo-boxes

  • 10 years ago
       As part of a project I'm currently working on I need a form which uses 2 combo-boxes to display the names of the winner and loser of a game.

    I've managed to get it to display 2 separate names, but cant get past the fact that they will always reset themselves to alphabetical order, so that the winner is always the one whos initial comes first (ie B before M).

    Does anyone know how to get around this, I'm sure it's a relatively simple excercise, but I cant for the life of me figure it out.

    I'd appreciate any help I could get.Crying [:'(]

    Thanks









  • 10 years ago
    The items in a combobox are only sorted if you set the 'sorted' property to true (by default it's false).  Have you done this?  I think I don't fully comprehend your situation.  Perhaps posting some code will help clear things up.
  • 10 years ago
        I'll try to explain my dilema a bit better. Each form has 2 combo-boxes on it, but both boxes need to access the same field of the same Access database to display the details of different club members.

     My problem is that the first box is supposed to show the winner of a competition, while the loser is shown in the second, however when I make a selection in the second box which comes before the selection in the first, the information displayed in each box is switched around, and the name which is first alphabetically is always shown in the first of the 2 boxes. Confusing huh(?!)

    I've checked the 'sorted' property and, as you said, they were both set to false, so its not that.

    Oh, and I havent written any code into them as yet, I have just linked them to the dataset.

    Any ideas?









  • 10 years ago
    Sorry, I'm thouroghly confused.  You say you haven't written any code and all you've got are two combo boxes linked to a dataset.  If there isn't any code then you can't expect anything to happen when a selection is made.  My general interpretation is that you want something to happen in 1 combobox when a selection is made in another.  For this you'll have to write some code.  Nothing is going to change if you don't change it.  At this point in time all you seem to have are two comboboxes with some data in them.  How they respond to selections is up to you.  It won't happen automatically.  Maybe I just don't get it.  If you have any code at all perhaps try posting it.  Maybe it will help me see things clearer.  Also I just don't really get how the combo boxes interact.  What does "the information displayed in each box is switched around" mean?  Try to explain it from a users perspective.  What would the user do and how should the information react?

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“The first 90% of the code accounts for the first 90% of the development time. The remaining 10% of the code accounts for the other 90% of the development time.” - Tom Cargill