Changing multiple ovalshape size during runtime
-
Tuesday, March 13, 2012 6:34 AM
Hi,
I am new to VB.2010, I am using the PowerPack and trying to change multiple ovalshape size, I have used the following code for changing multiple labels,
For Count As Integer = 1 To 100
Me.Controls("Label" & Count).Text= "Hello World"
Next CountIf I do the same for OvalShape, assume I have OvalShape1, OvalShape2.... OvalShape100
For Count As Integer = 1 To 100
Me.Controls("OvalShape" & Count).Size = New System.Drawing.Size(20, 20)
Next CountThe above throws error when executed.
Can anyone PLEASE guide/advice me what I am doing wrong.
Thanks In Advance
M.Pathma
All Replies
-
Tuesday, March 13, 2012 7:55 AM
You can't do that with shapes. They are not controls that are part of the controls collection of the form - they are shapes that are part of the shapes collection of the shapecontainer. You can't reference them by name. Use code like this:
For Count As Integer = 0 To 99 Me.ShapeContainer1.Shapes(Count).Size = New System.Drawing.Size(20, 20) Next CountYou might be trying to use shapes for a more sophisticated level of functionality than they were designed to support.- Proposed As Answer by Mark Liu-lxfModerator Thursday, March 15, 2012 2:29 AM
- Marked As Answer by Mark Liu-lxfModerator Thursday, March 22, 2012 5:41 AM

