Hi,
I would like to to to store the Name and Items of ComboBox into dictionary. With the below code,I am able to store them. However, Name of ComboBox is as counting ComboBox10 to ComboBox1n. I would like to store Name of ComboBox as ComboBox1,ComboBox2 rather than ComboBox10 to ComboBox1n for my futher propose.
It's not working with _dic.Add(ctl.Name, myCombo.Items(j).ToString) so I have to loop as _dic.Add(ctl.Name & j.ToString, myCombo.Items(j).ToString).
Would Appreciate your help and suggestion.
If TypeOf ctl Is ComboBox Then
myCombo = CType(ctl, ComboBox)
For j As Integer = 0 To myCombo.Items.Count - 1
_dic.Add(ctl.Name & j.ToString, myCombo.Items(j).ToString)
Next
Output
ComboBox10 One
ComboBox11 two
ComboBox12 Three
ComboBox20 Four
ComboBox21 Five
ComboBox22 Six