1. Technology
Send to a Friend via Email

Using Database Components (DB Aware Controls) in Delphi

How to efficiently use various data aware component in Delphi. Look for information on TTable, TQuery, TDBGrid, TDBNavigator ...

Alternate Row Color in Delphi's DBGrid
You've seen this surely on web pages. Alternating table row colors means displaying the first record in one color and the second record in another color and continue to alternate the color of each row displayed. Here's the OnDrawColumnCell event handler for a Delphi DBGrid control to color every second row in a different color.

Highlighting Delphi's DBGrid Row On Mouse Hover
What most Delphi developers are not aware of, is that you can even implement the OnMouseHover behavior to change the display (color, font, etc.) of the DBGRid's (data) row underneath the mouse - thus making it look like todays web driven interfaces.

Implementing MultiCast Events for Win32 Delphi's TDataset and TField descendants
When creating database applications in Win32 Delphi you might find the multicast idea useful - to have more than one procedure execute when the OnAfterScroll event fires for the TDataset descendant, for example. The "TMultiDsEvent" class enables you to add multicast event handlers feature TDataSet and TField descendants.

Using the TDBGrid component (in Delphi database applications)
Contrary to most other Delphi data-aware controls, the DBGrid component has many nice features and is more powerful than you would have thought. The "standard" DBGrid does its job of displaying and manipulating records from a dataset in a tabular grid. However, there are many ways (and reasons) why you should consider customizing the output of a DBGrid...

How to AutoFit the Columns in the TDBGrid
While DBGrid has many properties and events you can use to create nicelly looking and highly configurable user interfaces for data editing, there are always situations when users want more. Let's see how to add the "AutoFit" functionality to the Columns of a TDBGrid component...

How to Store and Retrieve DBGrid's Columns Order and Visibility
If you allow a user to customize DBGrid's appearance at run time (Columns width and position), when the form is closed and reopened, all the user changes are lost. For a better user experience it would be ideal if your application could somehow store (and load when needed) all the changes the user has made to the Grid appearance. Here's how.

A Guide to Using the TClientDataSet in Delphi applications
Looking for a single-file, single-user database for your next Delphi application? Need to store some application specific data but you do not want to user the Registry / INI / or something else?

Free Delphi ADO database course
In more than 25 chapters learn how to use various ADO components in Delphi.

Adding components to a DBGrid
How to place just about any Delphi control (visual component) into a cell of a DGBrid. Find out how to put a CheckBox, a ComboBox (drop down list box) and even an Image inside the DBGrid.

Adjusting DBGrid column widths automatically
Here's a handy method to automatically fix the size of TDBGrid columns (at run-time) to fit the DBGrid width (remove the unfilled space at the right edge of the grid; and consequently remove the horizontal scroll bar) when the user resizes the container containing the grid.

Coloring DBGrid
How to enhance the functionality of a TDBgrid component using colors.

Customizing the DBNavigator
Enhancing the TDBNavigator component with modified graphics (glyphs), custom button captions, and more. Exposing the OnMouseUp/Down event for every button.

DBGrid with MultiSelect
Multiple row selection in Delphi DBGrid - providing the ability to select multiple records within the grid. A Beginner's Guide to Delphi Database Programming: Appendix A.

Accessing and managing MS Excel sheets with Delphi
How to retrieve, display and edit Microsoft Excel spreadsheets with ADO (dbGO) and Delphi. This step-by-step article describes how to connect to Excel, retrieve sheet data, and enable editing of data (using the DBGrid). You'll also find a list of most common errors (and how to deal with them) that might pop up in the process.

A TreeView of Data
How to display a dataset of records from a table/query in a treeview component.

How to focus a specific cell (by field name) in a DBGrid Delphi component
Here's a simple trick to set the input focus to a specific cell of a TDBGrid component. Given the DBGrid's active row and field name (or the column index) the cell receives the input focus and becomes active.

Sorting records in Delphi DBGrid by Column title click
How to sort records (ADO dataset) in Delphi DbGrid by clicking on the column title. Plus: how to change the appearance of the selected column title to reflect the sort order. Even more: how to change the cursor when moving over the DBGrid column titles.

Inside TDataset
This presentation covers some of the internal workings of TDataset. The core functions needed to implement your own custom dataset are discussed and a demonstration dataset is developed.

©2014 About.com. All rights reserved.