Is it possible to find a combo box from the code with the "value member" property.
I would like to assign the text to the combo box found.
Thanks in advance
Yes, you can identify a ComboBox by its ValueMamber property:
Dim c As Object
For Each c In Me.Controls
If TypeOf c Is ComboBox Then
If c.valuemember = "<ValueMemberName>" Then
c.Text = "Found It!"
End If
End If
Next
Note: for <ValueMemberName>, substitute the ValueMamber you want to find.
Also, if the comboboxes are in a sub-container on the form - such as a Panel or GroupBox - you will need to use that in place of Me:
For Each c In Panel1.Controls
I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson
Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day! Ye has a choice: talk like a pira
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.