Shape.Name Property


Gets or sets the name of a line or shape control.

Namespace:   Microsoft.VisualBasic.PowerPacks
Assembly:  Microsoft.VisualBasic.PowerPacks.Vs (in Microsoft.VisualBasic.PowerPacks.Vs.dll)

public string Name { get; set; }

Property Value

Type: System.String

The name of the control. The default is an empty string ("").

When a line or shape control is added at design time, the name property is assigned a value that consists of the type of control plus a number. For example, the first OvalShape control added would be named "OvalShape1" and the second would be named "OvalShape2".

For line or shape controls created at run time with the New method, the Name property is an empty string ("").

The following example sets the Name property of an OvalShape control that is created by using the New method.

OvalShape os = new OvalShape();
ShapeContainer sc = new ShapeContainer();
sc.Parent = this;
os.Parent = sc;
// Assign a value to the Name property.
os.Name = "NewOval1";
Return to top