DataParameter.TryConvertValue Method

Attempts to convert the specified value to the specified type.

Namespace:  Microsoft.VisualStudio.Data
Assembly:  Microsoft.VisualStudio.Data (in Microsoft.VisualStudio.Data.dll)

Syntax

'宣言
Protected Overridable Function TryConvertValue ( _
    value As Object, _
    type As String _
) As Object
'使用
Dim value As Object
Dim type As String
Dim returnValue As Object

returnValue = Me.TryConvertValue(value, _
    type)
protected virtual Object TryConvertValue(
    Object value,
    string type
)
protected:
virtual Object^ TryConvertValue(
    Object^ value, 
    String^ type
)
protected function TryConvertValue(
    value : Object, 
    type : String
) : Object

Parameters

Return Value

Type: System.Object

Returns the converted value, or returns a null reference (Nothing in Visual Basic) if no conversion was possible.

Remarks

This method is called by the base implementation of OnTypeChanged to attempt to convert any currently set parameter value to the new type. The method should handle any value input, including Value and a null reference (Nothing in Visual Basic).

In the case of DBNull, the method should simply return DBNull is the converted value. In the case of a null reference (Nothing in Visual Basic), it should return a null reference (Nothing in Visual Basic).

The base implementation of this method handles the DBNull case and returns a null reference (Nothing in Visual Basic) for all other cases.

Permissions

See Also

Reference

DataParameter Class

DataParameter Members

Microsoft.VisualStudio.Data Namespace