Groups | Blog | Home
all groups > vb.net upgrade > april 2005 >

vb.net upgrade : DBGrid upgrade - VB 6.0 to VB.NET


EGC
4/12/2005 11:03:01 AM
I have a large project I have recently begun upgrading from VB 6 to VB.NET.
This project contains several DBGrid Controls and the problem I am having is
as follows:

This works fine in VB6 (my DBGrid Control is named dbgTest):

dbgTest.Columns.Add 2
'adds a third column to the grid with it's index being 2
dbgTest.Columns.Remove 2
'removes the just-added column

The upgrade wizard generates the following, which does not work:

dbgTest.get_Columns().Add(2)
dbgTest.get_Columns().Remove(2)

My question is, if I want to add and remove columns from these DBGrids
(found in Microsoft Data Bound Grid Control 5.0 (SP3)), what code should I
use?

Thanks in advance, Ethan


Earl
5/21/2005 10:32:33 AM
That isn't going to work properly. VB.Net only offers the Datagrid control
(although there are some excellent third-party grids out there). With the
Datagrid, you manipulate your columns using TableStyles.

The upgrade "wizard" can create some really bungled-up code, so I found it
only marginally useful.

[quoted text, click to view]

AddThis Social Bookmark Button