Page 271 - Open Soource Technologies 304.indd
P. 271
Unit 12: ADO Data Control
12.3.1 Conceptual Differences
12.3.1.1 Data Binding
The Visual Basic 2005 DataGridView control does not need data-specific methods or events
because all actions are performed through the data source. Because of this separation of presentation
and data functionality, the data source can be changed with or without user interface input. Also,
multiple controls bound to the same data source will always stay in sync.
12.3.1.2 Navigation
Properties for viewing and navigation in the DataGrid control (such as TabAction, EnterAction,
AllowArrows, WrapCellPointer, and Scrollable) are no longer needed. For example, the grid
functions as though the Scrollable property is set to True: If more data exists than can be
displayed, a scroll bar appears automatically. Excel-style navigation through the grid is the
default, allowing the user to move forward with the TAB key and backward with the SHIFT+TAB
key combination.
12.3.1.3 Caption Property
In Visual Basic 6.0, the Caption property is used to display a title bar above the grid; if the
Caption property is left empty, no title bar is displayed.
The Visual Basic 2005 DataGridView control does not support a title bar. However, you can
achieve the same effect using a Label control.
12.3.1.4 Data Formatting
In Visual Basic 6.0, formatting data in the DataGrid control is handled using the DataFormat
property and a StdDataFormat object. Formatting is applied on a column-by-column basis.
In the Visual Basic 2005 DataGridView control, formatting is accomplished using the Format
property of a DataGridViewCellStyle object. Formatting can be applied to individual cells,
columns, or rows.
12.3.1.5 hWndEditor Property
In Visual Basic 6.0, the hWndEditor property is used to pass the window handle assigned to a
DataGrid control’s editing window to a Windows API call.
The Visual Basic 2005 DataGridView control does not have a separate window handle when in
edit mode; instead, use the Handle property of the DataGridView control or any embedded edit
controls.
12.3.1.6 MarqueeStyle Property
In Visual Basic 6.0, the MarqueeStyle property controls the appearance of a selected cell or row
by changing the border style, inverting the foreground and background colors, or invoking an
edit window.
There is no direct equivalent for the Visual Basic 2005 DataGridView control. However, you can
achieve the same effect through a combination of the SelectionMode, CellBorderStyle, and
Format properties.
LOVELY PROFESSIONAL UNIVERSITY 265