ValidateName Method

Container.ValidateName Method

Determines whether the component name is unique for this container.

Namespace: System.ComponentModel
Assembly: System (in system.dll)

protected virtual void ValidateName (
	IComponent component,
	string name
protected void ValidateName (
	IComponent component, 
	String name
protected function ValidateName (
	component : IComponent, 
	name : String
Not applicable.



The named component.


The component name to validate.

Exception typeCondition


component is a null reference (Nothing in Visual Basic).


name is not unique.

The ValidateName method is called by the Add method to determine if the name of the component being added is unique for this Container. If the name parameter is not a null reference (Nothing in Visual Basic) and is not unique, an ArgumentException is thrown.

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

Community Additions

© 2015 Microsoft