DataParameter.TryConvertValue Method

Attempts to convert the specified value to the specified type.

Namespace:  Microsoft.VisualStudio.Data.Framework
Assembly:  Microsoft.VisualStudio.Data.Framework (in Microsoft.VisualStudio.Data.Framework.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

The converted value, or a null reference (Nothing in Visual Basic) if no conversion is 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. In the case of null, it should return null.

The base implementation of this method handles the DBNull case and returns null for all other cases.

Permissions

See Also

Reference

DataParameter Class

DataParameter Members

Microsoft.VisualStudio.Data.Framework Namespace