08-25-2003, 02:10 PM
Hello, I have a form with a Command button and a combo-box. The button opens another form in which i enter some values and submit it to the database, after submitting i come back to the main form(using secondform.hide, mainform.show).
What i am trying to do is refresh the combo box on the main form with the values i entered earlier in the second form.
But this does not work, i tried putting the addItem code in Main_form. load, MainForm.Activate etc nothing seems to refresh the combo box....
I hope i am clear in explaining the problem
any suggestions ?
08-25-2003, 02:22 PM
If you are using the second form to update a database, then just use the clear method of the combo box and reload it from the database the way you originally did.
08-25-2003, 02:26 PM
Hi LAr that is Ok. I am doing that , my problem is that it is not happening automatically when i come back to the main form.
I am calling the loadFromDatabase function in the Form Load , Form_activate events but it does not execute. I guess my problem is more about which form event to use to update the combo box.
08-25-2003, 02:29 PM
On the second form where you enter your values, refresh the data base when you click the submit button. I'm assuming you are also closing the form with the button so just make sure you put the code to refresh the database before that. you can refer to the combobox as follows:
08-25-2003, 02:55 PM
Yes i have tried that option, calling the method loadComBOx in the submit button of the second form, but somehow the combo box does not get Refreshed. If i do another step and put a command button on my main form and call the method from there, the combo box is getting refreshed. I think it is something to do with the show, hide , which event is called? that kind of problem.
08-25-2003, 03:03 PM
do you hide the first form when the second form is shown?
08-25-2003, 03:21 PM
Yes i do , and then at the end of submit button when i have added the values to the database, i do secondForm.hide, mainForm.show.
I am confused as to why mainForm.activate event is not called when i do mainForm.show
08-25-2003, 03:36 PM
And the funny thing is when I break and step through the code it seems to work perfectly, but when i execute it withoutbreaking it does not work..
08-25-2003, 10:56 PM
If it works during step through...you could try adding DoEvents somewhere...
Have you tried...