VB Migration Partner

KNOWLEDGE BASE - Forms and controls

Previous | Index | Next 

[INFO] Minor differences between VB6 and VB.NET DataGrid controls

VB Migration Partner converts VB6 applications that use the DataGrid control. However, the VB.NET application produced by the conversion process uses the “original” DataGrid control, which is accessed and manipulated through COM Interp. We have found that a few features of the control don’t work correctly when the control is placed on a .NET form:

  1. Most column properties set at design time – including Visible, Locked, Format, AllowSizing, WrapText, Alignment, DividerStyle, and Width – aren’t migrated.
  2. In VB6, assignments to the DefColWidth property are ignored if the VB6 developer had used the “Retrieve Fields” command to populate the grid’s column. In migrated VB.NET applications, however, assigning a value to this property resizes all the columns to the specified width.
  3. In a VB6 application you typically need to invoke the DataGrid.ReBind method after adding a new column to the grid, in order to fill the new column with values from the database. In VB.NET applications the ReBind method has the effect of restoring the original set of columns, therefore in practice you can’t add a column at runtime.
  4. Modifying the RowHeight property at runtime has no effect if the parent form has its ScaleMode property set to 0-User.
  5. Under VB.NET, the DataGrid control fires a few spurious GotFocus and LostFocus events. For example, when the user clicks on another cell on the same grid, the following events are fired under VB6: MouseDown, MouseUp, Click, RowColChange, RowColChange. The same action fires the following events under VB.NET: LostFocus, GotFocus, MouseDown, GotFocus, MouseUp, Click, RowColChange, RowColChange, LostFocus.

Even not counting these minor issues, we recommend that you don’t use the original DataGrid control through COM interop in real-world business applications, because this control is prone to unexpected behaviors (or crashes) when placed on a .NET form.

Previous | Index | Next 

Follow Francesco Balena on VB6 migration’s group on


Read Microsoft Corp’s official case study of a VB6 conversion using VB Migration Partner.

Code Architects and its partners offers remote and onsite migration services.

More details

Subscribe to our free newsletter for useful VB6 migration tips and techniques.


To learn more about your VB6 applications, run VB6 Analyzer on your source code and send us the generated text file. You will receive a detailed report about your VB6 applications and how VB Migration Partner can help you to quickly and effectively migrate it to .NET.

Get free advice

A fully-working, time-limited Trial Edition of VB Migration Partner allows you to test it against your actual code

Get the Trial

The price of VB Migration Partner depends on the size of the VB6 application, the type of license, and other factors

Request a quote

Migrating a VB6 application in 10 easy steps

Comparing VB Migration Partner with Upgrade Wizard

Migration tools: Feature Comparison Table

All whitepapers