Editable ListView Replacement, iGrid

Edited by

Microsoft ListView control isn't editable!

If you ever worked with the ListView control in report mode to emulate data grids, you already know that ListView does not allow you to do many things. The most annoying of them is that at some time we may need editable ListView, but ListView does not allow to edit its items and subitmes at all.

Our 10Tec grid called iGrid looks like ListView in report mode and allows us to edit its cells using several built-in editors. From this point of view, it can be used as an editable ListView replacement:

iGrid as a fast and flicker-free editable ListView replacement.

The main iGrid built-in cells editors are textbox editor, drop-down list (combo box) and check box. In ListView, you cannot edit ListView items and subitems unless you use tons of additional code to implement each editor and copy this code for every ListView that needs to be edited (see, for instance, this article: Creating editable ListView Control in C# programatically).

ListView flicker effect and more problems

ListView flickering is another well-known problem of this standard MS control. There are workarounds to eliminate the ListView Flicker effect in some particular situations or development environments, but it seems there is no universal solution for all cases.

Some other problems of ListView are the followings:

  • You cannot sort or group ListView items.
  • Every ListView item uses the same color and font.
  • ListView is slow when you work with big amounts of data.

A few words about coding

In iGrid you deal with cell matrix but not with the items/subitems ideology like in ListView. Thus, the iGrid syntax is easier and more native when you work with tabular data because you access every cell using the Cell(<row>, <column>) syntax like in a two-dimensional array. If we use Visual Basic syntax, your ListView calls like

ListView1.ListItems(1).SubItems(2) = "some text"

are transformed into something more understandable like

iGrid1.CellValue(1, 3) = "some text"

In iGrid you can use string keys to access rows and columns, and the calls above can be even more understandable if you use this feature:

iGrid1.CellValue("row_key", "description") = "some text"

Many everyday ListView tasks are implemented in code easily. For instance, to highlight rows with sales greater or equal to 50,000 like on the screenshot above, the following code is used:

Private Sub iGrid1_RowDynamicFormatting(ByVal lRow As Long, _
   oForeColor As Long, oBackColor As Long, oFont As stdole.Font)
   If iGrid1.CellValue(lRow, "Total Sales") >= 50000 Then
      oBackColor = RGB(224, 240, 240)
   End If
End Sub

What you get if you replace ListView with iGrid

If you replace ListView with iGrid, you provide your users with the following cool features:

  • iGrid's cells can store numeric or date values, or any other Variant values - in contrast to ListView items which are only strings.
  • If a cell is truncated, the full cell text can be displayed in the built-in tooltip when the user places the mouse pointer over the truncated cell.
  • ListView does not have frozen (fixed) columns, but iGrid does.
  • Full Unicode support.
  • Any column of your grid can be a treeview column!

VB ListView replacement and C# ListView replacement

At the end, some words about the supported development platforms. We have two versions of iGrid - one is ActiveX grid and the other is WinForms grid for .NET Framework. This means you can choose the required version of 10Tec grid control to be a powerful VB6 ListView replacement for the classic VB (Visual Basic 6) or VBA, or as a WinForms VB.NET ListView replacement or C# editable ListView control.

Detailed info about WinForms grid iGrid.NET »

Detailed info about ActiveX grid iGrid »