Control.Name Property

 

Gets or sets the name of the control.

Namespace:   System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

[<BrowsableAttribute(false)>]
member Name : string with get, set

Property Value

Type: System.String

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

The Name property can be used at run time to evaluate the object by name rather than type and programmatic name. Because the Name property returns a String type, it can be evaluated in case-style logic statements (Select statement in Visual Basic, switch statement in Visual C# and Visual C++).

The following code example displays the Name of a control in a MessageBox when the control is added or removed from a form.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 1.1
Return to top
Show: