Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Find combobox with value member property 1

Status
Not open for further replies.

myrgir

Programmer
Feb 7, 2006
62
CA
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
 
I have no clue what you're trying to do here...can you give a little bit more detail???
 
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top