I am in the process of converting a VB6 application to VB 2005. I used VB6's Hierarchical Flexgrid control and understand that it is possible to use it in VB 2005 as a COM control. However I have not been able to figure out how to do this. Any advice would be very much appreciated.
09-30-2010, 05:59 PM
In order to help migration from VB6 to VB.NET, Microsoft designed equivalents of a few non-standard controls from VB6 that are not provided by default in .NET. The FlexGrid is in that category. You will find them in the .NET Components after going into Choose Items... after right clicking in the ToolBox. They are all part of the Microsoft.VisualBasic.Compatibility library, a library that should be used only as a last resort when converting applications.
You will see that the FlexGrid is not part of that library, meaning that Microsoft was not able to make a decent adaptation of the FlexGrid for the .NET environment. That is probably due to the fact that the FlexGrid used Variant values a lot, and the Variant type is no longer supported in .NET.
You should be able to reference the control through the COM Components tab available when you right click in the ToolBox and select Choose Items... but I personnally would never do it. The Microsoft.VisualBasic.Compatibility library is already a bad thing to use. If Microsoft has not been able to provide you with a proper control adapted for .NET, you should expect that referencing the old one directly won't work or will bring in a lot of bugs.
Since there is no equivalent provided with .NET, you will have to resort to third party grids. You might want to search http://www.componentsource.com/index.html to see if they have something that could suits you.
10-01-2010, 08:11 AM
Thanks for the information. This sounds like good advice. My main reason for wanting to use the MSHFlexgrid control is that it permits cell merges, whereas the Datagridview does not appear to. It sounds like going the third party root might be the best bet.