Back to Devexpress

CellValue.TryCreateFromObject(Object) Method

officefileapi-devexpress-dot-spreadsheet-dot-cellvalue-dot-trycreatefromobject-x28-system-dot-object-x29.md

latest6.5 KB
Original Source

CellValue.TryCreateFromObject(Object) Method

Tries to convert the specified object to a cell value using the default converter.

Namespace : DevExpress.Spreadsheet

Assembly : DevExpress.Spreadsheet.v25.2.Core.dll

NuGet Package : DevExpress.Spreadsheet.Core

Declaration

csharp
public static CellValue TryCreateFromObject(
    object value
)
vb
Public Shared Function TryCreateFromObject(
    value As Object
) As CellValue

Parameters

NameTypeDescription
valueObject

An object to be converted to a CellValue.

|

Returns

TypeDescription
CellValue

A CellValue object. If the conversion cannot be performed, the TryCreateFromObject method returns null (Nothing in VB).

|

Remarks

To convert a cell value to an object, use the CellValue.ToObject method. For more information on cell values and their types, refer to Cell Data Types.

The following code snippets (auto-collected from DevExpress Examples) contain references to the TryCreateFromObject(Object) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

how-to-bind-a-worksheet-to-a-generic-list-or-a-bindinglist-data-source/CS/DataBindingToListExample/MyConverter.cs#L46

csharp
return CellValue.TryCreateFromObject(value);
}

wpf-spreadsheet-bind-a-worksheet-to-generic-list-or-bindinglist-data-source/CS/DataBindingToListExample/MyConverter.cs#L46

csharp
return CellValue.TryCreateFromObject(value);
}

spreadsheet-document-api-data-binding/CS/SpreadsheetApiDataBinding/MyConverter.cs#L56

csharp
return CellValue.TryCreateFromObject(value);
}

spreadsheet-document-api-import-data-from-data-sources/CS/DataImportExample/TestDataValueConverter.cs#L33

csharp
}
result = DevExpress.Spreadsheet.CellValue.TryCreateFromObject(value);
return true;

how-to-bind-a-worksheet-to-a-generic-list-or-a-bindinglist-data-source/VB/DataBindingToListExample/MyConverter.vb#L48

vb
Return CellValue.TryCreateFromObject(value)
End Function

wpf-spreadsheet-bind-a-worksheet-to-generic-list-or-bindinglist-data-source/VB/DataBindingToListExample/MyConverter.vb#L48

vb
Return CellValue.TryCreateFromObject(value)
End Function

spreadsheet-document-api-data-binding/VB/SpreadsheetApiDataBinding/MyConverter.vb#L46

vb
Return CellValue.TryCreateFromObject(value)
End Function

spreadsheet-document-api-import-data-from-data-sources/VB/DataImportExample/TestDataValueConverter.vb#L31

vb
result = DevExpress.Spreadsheet.CellValue.TryCreateFromObject(value)
Return True

winforms-spreadsheet-import-data-from-different-data-sources/VB/DataImportExample/TestDataValueConverter.vb#L31

vb
result = DevExpress.Spreadsheet.CellValue.TryCreateFromObject(value)
Return True

See Also

FromObject

ToObject

SetValue(Object)

Value

Cell Data Types

How to: Change a Cell or Cell Range Value

How to: Convert Objects to Cell Values and Cell Values to Objects

CellValue Class

CellValue Members

DevExpress.Spreadsheet Namespace