updating a sql server table from dynamically created combobox
Posted on 2004-03-23
I have a form with dynamically created comboboxes in which a user enters values. What I want to do is (when user clicks SAVE button) take these combobox values and insert into a SQL Server 2000 table in the backend. The combobox is defined as a class and the different instances are created dynamically on the form. My problem is how to refer to different combobox values in code?
For example, cboValue is the combobox which has 5 instances and hence 5 values given to it. cboValue.selectedvalue will give me a value that I can insert into a table. The problem is I can get only the last combobox value this way. I want something like this:
for i = 1 to 5
insert into table1 (field1) values cboValue.i
cboValue.i is where the mess happens - how do I refer to the 5 different combo values - I have tried these so far with no success -
cboValue & cstr(i);
This is a pretty general problem that could apply to any class and its instances. Thanks for any help...