vbAccelerator SGrid II Control Replacement

If you are a Visual Basic developer and ever needed an unbound grid control, most likely you already know the excellent vbAccelerator SGrid Control:

vbAccelerator SGrid II Control Demo

iGrid was developed as an SGrid replacement in far 2000-2001 and was published as an independent control with powerful improvements on this site in 2002. The author of the original S-Grid control, Steve McMahon, also released a major update called vbAccelerator SGrid II Control on his website later.

You can find out more about the creation history of iGrid and the main difference between iGrid and vbAccelerator SGrid control on this page.

SGrid replacement

It seems, every Visual Basic developer ever creates an interface to display tabular data. Sometimes the data should be editable. Users often want to manipulate these data - to sort and search, to group rows, etc. Also, the rows of data aren't always stored in a database and may contain a lot of graphical information.

If you want to use one of the standard Visual Basic grid controls in such applications, you will find that neither MSFlexGrid nor ListView from MS Common Controls in the report mode can provide you with the functionality described above to the full.

Our company was also confronted with such difficulties while developing applications for our local customers, so we decided to create own grid control that would allow us to implement the tasks described above. We didn't want to create a grid that only automates all standard tasks (sort, search, etc.), we wanted the developer to have influence on these processes and adjust them exactly the way they need.

We started to search for source codes that can help us to implement what we need, and found an excellent website with source codes - vbAccelerator.com. vbAccelerator's source codes and binaries are provided for reuse in any of your projects, whether proprietary, commercial or open-source according to their Usage Policy. vbAccelerator was the most appropriate starting point for us.

One of the vbAccelerator components was the SGrid grid control. It could display string datat, but the user could not edit SGrid cells. We needed an editable grid control with built-in main cell editors like singleline and multiline textboxes, comboboxes with icons, and checkboxes. Moreover, the developer should have been provided with a standard set of events which work identically for all built-in editors to control every stage of the editing process.

As a result, we created the iGrid ActiveX Control as an editable SGrid replacement. We have been working on this component since 2000, and are continuing to enhance its functionality today. It required many years to fix all the bugs in the unsupported SGrid, incorporate the built-in editors, optimize the control so it works much faster. We also added many big and small useful features to make the life of the developer easier.

Main differences between vbAccelerator SGrid and 10Tec iGrid

Built-in cell editors

vbAccelerator SGrid control in its original implementation does not provide you with any cell editing features. In SGrid, you can just display strings but you cannot even edit them using a text editor like the standard text box. iGrid gives you built-in cell editors to edit texts "as is" or to use a drop-down (combo) list to select a predefined value. Another useful control which can be displayed in any cell is check box. The Built-in Cell Editors page in this section will give you more detailed info about the iGrid editing features.

Variant cell values

In the original SGrid you can operate only with strings stored in its cells. Every cell of iGrid has a cell value of the Variant data type (the CellValue property) and provides you with the corresponding string representation on the screen (it can be retrieved with the read-only CellText property of the String data type). Thus a cell can store any value you want, and the displayed representation of this value may differ from the cell value a lot (for instance, you can use format strings or dynamic cell text).

Images of different sizes in cells and column headers

SGrid allows you to use icons for its cells and column headers stored in a single ImageList. This is a serious restriction if you want to use icons of different sizes for your cells and column headers - for instance, small 16x16 icons in column headers and larger detailed 32x32 icons in the grid cells. iGrid does not have this restriction:

Different cell icons in a descendant of vbAccelerator SGrid, iGrid ActiveX

You can use images in all its constituent parts (cells, column headers, combo boxes), and each item can be linked to its own image list. Moreover, you can even use up to 15 image lists for the cells!

More effective coding

iGrid provides you with many methods and properties which automate frequently performed tasks. In some cases, you should write 20-50 lines of code to do that in SGrid. Here are a couple of samples.

You can use the DoDefaultSort method to sort the specified column as if the user clicked its column header (if the column has not been sorted, it is sorted ascending; otherwise it is sorted descending, and vice versa). This method also allows you to add new columns to the existing set of sorted columns programmatically to implement multi-column sorting.

It is considered good practice if your application saves the order and width of each column, and restores these parameters when the user launches the application with your grid next time. iGrid automates this task by providing the LayoutCol property to developers. To implement this functionality, save the string returned by this property when the user closes your application, and assign the stored string to the LayoutCol property when the user launches your application again. iGrid will automatically restore the order, width and visibility for each column. You can also do the same to save and restore the current sorting criteria with the LayoutSort property.

Fast population and row deletion

Sometimes you need to add a huge number of rows to a grid, and the number of rows to add is not known beforehand. SGrid works slowly if you add a lot of rows using the AddRow method. iGrid uses effective page memory allocation technology which speeds up the execution up to ten times.

vbalsgrid6.ocx run-time error '0'

vbAccelerator SGrid is implemented in the vbalsgrid6.ocx file. But if you think it is enough to download vbalsgrid6.ocx to use vbAccelerator SGrid in your app, it is not true. vbAccelerator SGrid uses the external subclassing and timer assistance library named SSubTmr, which is implemented in the separate SSubTmr6 DLL. You also need to include SSubTmr6.DLL into the deployment package and properly register it as an ActiveX COM DLL on the client computers. If anything is wrong with this external DLL, your application becomes completely unusable - you get the vbAccelerator SGrid II Control Run-Time Error '0' message or something like that.

Our development policy for all 10Tec controls is to avoid any external dependencies. In the case of the iGrid control you just need to redistribute one OCX file with your app. Despite the fact that iGrid does not reference any external libraries, it provides you with the ability to browse ADO and DAO recordsets using COM late binding. It also gives you the native OS look-and-feel by using the OS visual styles in all recent versions of MS Windows, including Windows 7 and Windows 10.

All revealed SGrid bugs were fixed

Actually, creating a good and robust grid control is a hard and long road, and our comprehensive What's New documents written for every 10Tec control prove that. Many users already heard about that sadly known runtime error 0 in vbAccelerator SGrid, but there are more subtle bugs related to functionality and drawing routines. Even after 10 years of work on iGrid, our users reported bugs which had come from the original SGrid source code. Unfortunately, vbAccelerator SGrid II Control is no longer supported, but as for iGrid, we are still fixing all revealed SGrid bugs in our grid control.

Online library of extra samples for iGrid »