BaseCompareValidator.Convert Method (String, ValidationDataType, Boolean, Object)

Converts the specified text into an object of the specified data type. This version of the overloaded method allows you to specify whether values are converted using a culture-neutral format.

Namespace: System.Web.UI.WebControls
Assembly: System.Web (in system.web.dll)

protected:
static bool Convert (
	String^ text, 
	ValidationDataType type, 
	bool cultureInvariant, 
	[OutAttribute] Object^% value
)
protected static boolean Convert (
	String text, 
	ValidationDataType type, 
	boolean cultureInvariant, 
	/** @attribute OutAttribute() */ /** @ref */ Object value
)
Not applicable.

Parameters

text

The text to convert.

type

One of the ValidationDataType values.

cultureInvariant

true to convert values to a culture-neutral format; otherwise, false.

value

When this method returns, contains an object with the conversion result. This parameter is passed uninitialized.

Return Value

true if the conversion is successful; otherwise, false.

The Convert(String,ValidationDataType,Boolean,Object) method is used to convert text into an object of the specified data type. Although the method returns true or false to indicate whether the conversion was successful, the converted value is stored in the valueout parameter.

NoteNote:

If the conversion is unsuccessful, the value parameter is set to a null reference (Nothing in Visual Basic).

To indicate that values should be converted using a culture-neutral format, pass in true for the cultureInvariant parameter; otherwise, values are converted using the format used by the current culture. When converting a value using the format used by the current culture, consider using the BaseCompareValidator.Convert(String,ValidationDataType,Object) overloaded version of this method.

Windows 98, Windows Server 2000 SP4, 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

ADD
Show: