B
B
bender30002016-11-26 08:35:59
Visual Basic
bender3000, 2016-11-26 08:35:59

How to insert an array of items with .Itemdata(0) into a loop?

there is an array of comboboxes in the loop
For i = 0 To 22
effort = Array(Me.effort0, Me.effort1, Me.effort2, Me.effort3, Me.effort4, Me.effort5, Me.effort6, Me.effort7, Me.effort8 Me.effort16 .effort21, Me.effort22)
After executing the sql query, I want to display the value and write
effort(i) = effort(i).ItemData(0)
The values ​​get into the combobox but are not displayed, now I stupidly did this:
'Me.effort0 = Me.effort0.ItemData(0)
'Me.effort1 = Me.effort1.ItemData(0)
'Me.effort2 = Me.effort2.ItemData(0)
'Me.effort3 = Me.effort3.ItemData(0)
'Me. effort4 = Me.effort4.ItemData(0)
'Me.effort5 = Me.effort5.ItemData(0)
'Me.effort6 = Me.effort6.ItemData( 0
)
0)
'Me.effort9 = Me.effort9.ItemData(0)
'Me.effort10 = Me.effort10.ItemData(0)
'Me.effort11 = Me.effort11.ItemData(0)
'Me.effort12 = Me.effort12. ItemData(0)
'Me.effort13 = Me.effort13.ItemData(0)
'Me.effort14 = Me.effort14.ItemData(0)
'Me.effort15 = Me.effort15.ItemData(0)
'Me.effort16 = Me. effort16.ItemData(0)
'Me.effort17 = Me.effort17.ItemData(0)
'Me.effort18 = Me.effort18.ItemData(0)
'Me.effort19 = Me.effort19.ItemData(0)
'Me.effort20 = Me.effort20.ItemData(0)
'Me.effort21 = Me.effort21.ItemData(0)
'Me.effort22 = Me.effort22.ItemData(0)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Artyom Karetnikov, 2016-11-27
@art_karetnikov

Good. To work with elements, there is FOR Each ... IN.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question