BaseCompareValidator.Convert Método
Definição
Converte o texto especificado em um objeto do tipo de dados especificado.Converts the specified text into an object of the specified data type.
Sobrecargas
| Convert(String, ValidationDataType, Object) |
Converte o texto especificado em um objeto do tipo de dados especificado.Converts the specified text into an object of the specified data type. Essa versão do método sobrecarregado converte os valores de moeda, de duplo e de data usando o formato usado pela cultura atual.This version of the overloaded method converts currency, double, and date values using the format used by the current culture. |
| Convert(String, ValidationDataType, Boolean, Object) |
Converte o texto especificado em um objeto do tipo de dados especificado.Converts the specified text into an object of the specified data type. Esta versão do método sobrecarregado permite que você especifique se os valores são convertidos usando um formato de cultura neutra.This version of the overloaded method allows you to specify whether values are converted using a culture-neutral format. |
Convert(String, ValidationDataType, Object)
Converte o texto especificado em um objeto do tipo de dados especificado.Converts the specified text into an object of the specified data type. Essa versão do método sobrecarregado converte os valores de moeda, de duplo e de data usando o formato usado pela cultura atual.This version of the overloaded method converts currency, double, and date values using the format used by the current culture.
protected:
static bool Convert(System::String ^ text, System::Web::UI::WebControls::ValidationDataType type, [Runtime::InteropServices::Out] System::Object ^ % value);
protected static bool Convert (string text, System.Web.UI.WebControls.ValidationDataType type, out object value);
static member Convert : string * System.Web.UI.WebControls.ValidationDataType * obj -> bool
Protected Shared Function Convert (text As String, type As ValidationDataType, ByRef value As Object) As Boolean
Parâmetros
- text
- String
O texto a ser convertido.The text to convert.
- type
- ValidationDataType
Um dos valores de ValidationDataType.One of the ValidationDataType values.
- value
- Object
Quando esse método retorna, contém um objeto com o resultado da conversão.When this method returns, contains an object with the conversion result. Este parâmetro é passado não inicializado.This parameter is passed uninitialized.
Retornos
true se a conversão for bem-sucedida; caso contrário, false.true if the conversion is successful; otherwise, false.
Comentários
O Convert(String, ValidationDataType, Object) método é usado para converter o texto em um objeto do tipo de dados especificado.The Convert(String, ValidationDataType, Object) method is used to convert text into an object of the specified data type. Embora o método retorne true ou false indique se a conversão foi bem-sucedida, o valor convertido é armazenado no value out parâmetro.Although the method returns true or false to indicate whether the conversion was successful, the converted value is stored in the value out parameter.
Observação
Se a conversão não for bem-sucedida, o value parâmetro será definido como null .If the conversion is unsuccessful, the value parameter is set to null.
Esta versão do método converte valores usando o formato usado pela cultura atual.This version of the method converts values using the format used by the current culture. Para converter valores usando um formato de cultura neutra, use a BaseCompareValidator.Convert(String, ValidationDataType, Boolean, Object) versão sobrecarregada desse método.To convert values using a culture-neutral format, use the BaseCompareValidator.Convert(String, ValidationDataType, Boolean, Object) overloaded version of this method.
Confira também
Aplica-se a
Convert(String, ValidationDataType, Boolean, Object)
Converte o texto especificado em um objeto do tipo de dados especificado.Converts the specified text into an object of the specified data type. Esta versão do método sobrecarregado permite que você especifique se os valores são convertidos usando um formato de cultura neutra.This version of the overloaded method allows you to specify whether values are converted using a culture-neutral format.
protected:
static bool Convert(System::String ^ text, System::Web::UI::WebControls::ValidationDataType type, bool cultureInvariant, [Runtime::InteropServices::Out] System::Object ^ % value);
protected static bool Convert (string text, System.Web.UI.WebControls.ValidationDataType type, bool cultureInvariant, out object value);
static member Convert : string * System.Web.UI.WebControls.ValidationDataType * bool * obj -> bool
Protected Shared Function Convert (text As String, type As ValidationDataType, cultureInvariant As Boolean, ByRef value As Object) As Boolean
Parâmetros
- text
- String
O texto a ser convertido.The text to convert.
- type
- ValidationDataType
Um dos valores de ValidationDataType.One of the ValidationDataType values.
- cultureInvariant
- Boolean
true para converter valores em um formato de cultura neutra; caso contrário, false.true to convert values to a culture-neutral format; otherwise, false.
- value
- Object
Quando esse método retorna, contém um objeto com o resultado da conversão.When this method returns, contains an object with the conversion result. Este parâmetro é passado não inicializado.This parameter is passed uninitialized.
Retornos
true se a conversão for bem-sucedida; caso contrário, false.true if the conversion is successful; otherwise, false.
Comentários
O Convert(String, ValidationDataType, Boolean, Object) método é usado para converter o texto em um objeto do tipo de dados especificado.The Convert(String, ValidationDataType, Boolean, Object) method is used to convert text into an object of the specified data type. Embora o método retorne true ou false indique se a conversão foi bem-sucedida, o valor convertido é armazenado no value out parâmetro.Although the method returns true or false to indicate whether the conversion was successful, the converted value is stored in the value out parameter.
Observação
Se a conversão não for bem-sucedida, o value parâmetro será definido como null .If the conversion is unsuccessful, the value parameter is set to null.
Para indicar que os valores devem ser convertidos usando um formato de cultura neutra, passe true para o cultureInvariant parâmetro; caso contrário, os valores são convertidos usando o formato usado pela cultura atual.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. Ao converter um valor usando o formato usado pela cultura atual, considere usar a BaseCompareValidator.Convert(String, ValidationDataType, Object) versão sobrecarregada desse método.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.