Bind Combobox to SQL Query at Runtime
I have a process inside a form runtime modification where I need to create comboboxes on the fly and populate the list from a SQL query. I might need two dropdowns, I might need ten, I don't know until runtime. Each dropdown is also populated on the fly. I can run a SQL query during runtime mod and turn the results into a DataItem List, but I am stuck at the point where I bind a new combobox to the DataItem list.
I can see no way to do this without literally iterating through the DataItem list and doing an add to the combobox one value at a time. I am struggling with a way to directly bind the combobox to the DataItem list I create, so if anyone has suggestions, please let me know how this should look with either an assign or cast operation.
0
-
In the Runtime Modifications, you could probably use a AddRangeToCollection<DataItem> activity. The collection is form.Find(Of ComboBoxFormItem)("ComboBox1").DataItems and the items are in the list of dataitems you created.
Of course, if you already created the combobox on the fly, the collection could be simplified to myCombobox.DataItems.0
Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.
Kommentare
1 Kommentar