none
ComboBox Refresh RRS feed

  • Question

  • I have a form with a combobox that is filled with a list of parts from a mysql DB. But the table contains more then 1000 parts. So I decided to load only the first 20. then have 2 bottuns 1 for UP and one for Down. when the user wants to get next 20 he press Down Etc. I see that the data is retrived well from the DB. I use a stored procedure with parameters and test it outside the VB code. In the VB debug I also see that the combobox got loaded with the right data. But the drop down list continue to show the original 20 parts. I also have a code to see if I got to the top or to the end and display a message box. I got the message box display but still the drop down is showing the original 20 parts. I tried refresh the control without help.
    Friday, February 25, 2011 12:57 PM

Answers

  • Finally I find the problem and it is not in the combobox it is in the parameter setup to the stored procedure.

    I changed it to a dynamic sql staement and now it works. I will investigate the stored procedure to see why it happened. Since tring it outside of VB it works without any problem.

    But I do have another issue and this one is related to the behave of the combobox. When I load it with 20 lines I also set the .dropeddown to true in order to show the drop down list. Work fine. But when I press the down bootun to scroll to the next 20 lines the first click actually close the drop down list and I have to click the bottun again to get the next 20 lines. how I can prevent this behaviour. I want the the first click on the down or up bootuns will bring me the next 20 or the previous 20 without the need to click on it again.

    Sunday, February 27, 2011 7:53 PM

All replies

  • Probably you use a fill and don't clear the datasource in advance.

    Dataset.Clear or DataTable.Clear before the fill


    Success
    Cor
    Friday, February 25, 2011 1:07 PM
  • use the Clear method of the ComboBox Items before filling again:

    ComboBox1.Items.Clear()
    
    Friday, February 25, 2011 3:19 PM
  • the Combobox does not have a data source assgined to I have a sub that perform the fill of the combo box and it have a combobox.items.clear(). I fill by having an .update then a loop with .add and the .end update.

    But for some reason that I can't find way the drop down continiue to show the first 20 lines. !

    Saturday, February 26, 2011 5:06 PM
  • Finally I find the problem and it is not in the combobox it is in the parameter setup to the stored procedure.

    I changed it to a dynamic sql staement and now it works. I will investigate the stored procedure to see why it happened. Since tring it outside of VB it works without any problem.

    But I do have another issue and this one is related to the behave of the combobox. When I load it with 20 lines I also set the .dropeddown to true in order to show the drop down list. Work fine. But when I press the down bootun to scroll to the next 20 lines the first click actually close the drop down list and I have to click the bottun again to get the next 20 lines. how I can prevent this behaviour. I want the the first click on the down or up bootuns will bring me the next 20 or the previous 20 without the need to click on it again.

    Sunday, February 27, 2011 7:53 PM