Philippe Renaud
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
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
What version of .Net are you using 2003 or 2005?
ASKER
2005
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
In 2005 you can do this
Dim btn() As Control = Me.Controls.Find("Button5" , True)
Fernando
Dim btn() As Control = Me.Controls.Find("Button5"
Fernando
ASKER
I wanted to split points, But i clicked at the wrong place
ASKER
Well, the hastable do the same thing i guess, but I found it great to do it with a dictionnary.