Results 1 to 5 of 5

Thread: ComboBox blocks other comboboxes in GroupBox

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Apr 2013
    Posts
    134

    ComboBox blocks other comboboxes in GroupBox

    Hi!

    I'm confused. While my comboboxes were not in use they worked fine(were populated and I could scroll the lists and select any item). Now, as I am using the selectedValue any combobox blocks all other formelements in the group box.
    E.g. when I select a value in one of the comboboxes, I get the results based on the selected item, BUT a blinking cursor stays in the combobox, the text of the selected value stays selected and no other combobox opens on mouse clicks. I also cannot switch controls with Tab. I tried to reset the Focus to another element in the form, this does not change anything.

    Application works and I cannot find any error or exception with the debugger. If I start the selection on another combobox, then this one blocks all other elements. The comboboxes are bound to different Data Sources. The Datasources use the same Database string and the same database table. Help, please!

  2. #2
    PowerPoster dunfiddlin's Avatar
    Join Date
    Jun 2012
    Posts
    8,245

    Re: ComboBox blocks other comboboxes in GroupBox

    The comboboxes are bound to different Data Sources.
    No they're not. They're bound to the same datasource. The values they display and return are from different columns in the table but it's the same table. So when you select one value, the bindings require that the remaining boxes are locked to that selection. If you want these values to be selectable independent of each other (and I can't at the moment think of any reason why you would!) then you must fill a new datatable for each of them to use as its own datasource.
    As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"

    Reviews: "dunfiddlin likes his DataTables" - jmcilhinney

    Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Apr 2013
    Posts
    134

    Re: ComboBox blocks other comboboxes in GroupBox

    Dear Dunfiddlin,

    thank you for lighting things up to me.
    The reason for haveing two independent comboboxes from one table is, that the table lists all companies used in the application(no I have not designed this table structure, but it doesn't seem too wrong for me), where many companies can have multiple properties like is_seller, is_buyer, is_shipper, is_stocker.
    So one combo box selects seller, one selects buyer, one selects shipper, one selects stocker. Usually one would work only with the first two, select a seller and buyer and get the invoices listed. But also the other combos are used sometimes.
    OK, now I know at least where to look at, thanks again!

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Apr 2013
    Posts
    134

    Re: ComboBox blocks other comboboxes in GroupBox

    OK, so what I have done is - I have removed the DataBindings to the comboboxes and have left only the DataSource and Display Member properties with the right Data Sources selected. Now the comboboxes work without blocking each other. So my main problem was, that I thought Data Binding defines the source for the data and which column is shown and which selected. But Data Bindings does completely other things related to data exchange between the control and the database. Please correct me if I'm still wrong.

    BTW I had some problems figuring out how to get the Selected ID(not the index of the item in the combobox), while showing only titles from the two column(id, title) dataset. Currently I use this code
    Code:
    comboBox1.SelectedValue.Row.ItemArray(0)
    to get the ID.

  5. #5
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,414

    Re: ComboBox blocks other comboboxes in GroupBox

    Quote Originally Posted by AndyLD View Post
    OK, so what I have done is - I have removed the DataBindings to the comboboxes and have left only the DataSource and Display Member properties with the right Data Sources selected.
    that's the correct way. I don't know exactly how you had your code before, but as you guessed, that was causing the problem you were experiencing.
    i'm not sure dunfiddlin grasped the problem there

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width