Link to home
Start Free TrialLog in
Avatar of Philippe Renaud
Philippe RenaudFlag for Canada

asked on

For each in Me.Controls

Hi,

I got many buttons okay. Lets say 6 with their names:   Button1, Button2, Button3 etc.
I want to manipulate for example Button4.

I would like to manipulate that way:

dim str = "Button", x as Integer = 1
("Button" + x).Name .....

I know, we cant do that. I know its possible by the way of a For each than you check the ctrl.Name , then if its then same, you can play with it. But I tought it was not 100% efficiant.  Is there a way like my ("Button" + x)  to call that button other than a for each, other than calling Button4.name too ... the thing is, it will be never the same button. It might change that why I was needed that integer (x) or a for each

Thanks
SOLUTION
Avatar of Fernando Soto
Fernando Soto
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
What version of .Net are you using 2003 or 2005?
Avatar of Philippe Renaud

ASKER

2005
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
In 2005 you can do this

     Dim btn() As Control = Me.Controls.Find("Button5", True)

Fernando
I wanted to split points, But i clicked at the wrong place
Well, the hastable do the same thing i guess, but I found it great to do it with a dictionnary.