dynamic binding a combo box
-
Hi, I have a combobox, for users. It's a lookup, which gets the user names from the table "tblContacts" field "Name". when the form loads, the combobox gets populated. There is also one button to add the user, if the user is not available in the table, and onClick the Add button, which will pop-up one more form, to add the new user. it does fine, adds the user to the table. but it dosen't populate the combobox immediately with the new user just added. when the form loads, i was storing all the values in an Arraylist from the table and specifying the combobox datasource as the Arraylist. can anyone tell me how to dynamically bind the combobox, which will reflect the new records added. Thanx vijay
-
Hi, I have a combobox, for users. It's a lookup, which gets the user names from the table "tblContacts" field "Name". when the form loads, the combobox gets populated. There is also one button to add the user, if the user is not available in the table, and onClick the Add button, which will pop-up one more form, to add the new user. it does fine, adds the user to the table. but it dosen't populate the combobox immediately with the new user just added. when the form loads, i was storing all the values in an Arraylist from the table and specifying the combobox datasource as the Arraylist. can anyone tell me how to dynamically bind the combobox, which will reflect the new records added. Thanx vijay
That's is because you combo box's data source is set to ArrayList that is not updated when you add new user. The new user is added to the table without syncronizing the ArrayList. Try to replace all the values in the ArrrayList with the table when there is new user added. I am not expert. I am just a beginner. Learning .NET