Accessing data values using DataWindow data expressions

DataWindow data expressions use the Data, SelectedData, and DataWindowRow classes.

The Data class represents the data rows and columns in a DataWindow data buffer and allows you to access data using C# indexers. There is a Data object for each of the DataWindow buffers: PrimaryData, FilteredData, and DeletedData. The SelectedData class represents the highlighted rows in a DataWindowControl. The DataWindowRow class represents a row in a data buffer.

NoteNot available for Web DataWindows The PrimaryData, FilteredData, and DeletedData fields are not available on the WebDataWindowControl.

Data values for single items are returned as a System.Object. Data values for multiple items are returned as an array of objects. Data values for multiple rows are returned as an array of Object arrays.

To set data values, use an Object for a single value, an array of objects for multiple values, or an array of Object arrays for multiple values in multiple rows. The Data class has a Rows property to access all current data values in all rows and an OriginalValues property to access all original data values in all rows.

The Data.Item property

You use the Item property of the data buffer objects to access data values. The basic syntax for indexer access to DataWindow data in data buffers is:

Object Obj = dwcontrol.Buffername [args...]

For a complete list of syntaxes, see the Data.Item property in the online Help in Visual Studio .NET. Here are some Visual Basic samples:

Rows property

The Data and SelectedData classes both have a Rows property. The Rows property for Data allows you to access and set the current data values of all rows in a buffer. The Rows property for SelectedData lets you access the current data values in selected rows. For example, this statement gets the data in selected rows:

Dim rows as Object 
rows = dw_1.SelectedData.Rows

OriginalValues property

The Data and SelectedData classes both have an OriginalValues property. The OriginalValues property for Data allows you to access the original data values of all rows in a buffer. The OriginalValues property for SelectedData lets you access the original data values in selected rows. For example, this statement gets the primary buffer's original data values:

Dim O as Object 
O = dw_1.PrimaryData.OriginalValues