ComponentOne True DataControl 8.0
Using Memory Array Mode for Binding Controls to Variables

As the word “array” suggests, you can use the memory array mode to expose two-dimensional data, in other words, multiple rows of columns (fields), to a bound control. Perhaps even more useful is the situation where there is only one row of data. In this case, the data effectively consists of several variables (fields) stored in memory. Each of the fields has only one value, exactly as a normal Visual Basic variable.

Using True DataControl in this capacity allows you to bind controls, such as TextBox, ComboBox, CheckBox and others to memory variables, as though the controls are bound to simple Visual Basic variables. You are probably accustomed to perceiving data binding as a means of working with a database. It's much more than that! True DataControl brings the codeless convenience of data binding to the sections of your application that don’t deal with a database, so you don’t have to write code performing all chores of data exchange between variables and controls. Even more, modifying a variable (field) triggers immediate update of all dependent fields and expressions, according to the general True DataControl rules. So you can specify rules relating your bound controls to each other and to your variables without routine coding.

The practice of using True DataControl for binding to variables is a useful technique rather than a special True DataControl feature. You don’t need to do anything special to apply it. All you have to do is to create a TData control with DataMode = 1 - Memory Array, and define one field for each variable. You can instantly use such TData controls as a data source for your bound controls. In this case, you would typically use a TData control with its Visible property set to False, since there is no need for the user to navigate a single record.

This technique can be used in countless situations, wherever you have variables that must be displayed and modified in controls. You can see some examples in True DataControl tutorials, where a memory array True DataControl with a single record is used to eliminate manual coding in the following common scenarios:

 

 


Copyright (c) GrapeCity, inc. All rights reserved.

Product Support Forum  |  Documentation Feedback