Grids

These are the options for the grid controls supported by the VBUC out of the box. This list includes the most common controls used by VB6 applications.

It is worth remembering that the VBUC is a fully customizable tool, therefore if an application uses a grid control not present in this list, it is possible for Mobilize to create customization to migrate it automatically to a .NET component.

1. FPSpread

1.1. To FarPoint Spread helper class

Conversion of FarPoint Spread for Windows Forms using a helper class.

The VBUC supports FPSpread version 3.0.37

General Description:

The FarPoint Spread for Windows Forms is a comprehensive spreadsheet component for Windows applications that combines grid capabilities, spreadsheet functionality, and includes the ability to bind to data sources or programmatically inserted data.

Deployment Note:

The VBUC converts the FPSpread ActiveX to a helper class.

Original VB6 code:

Begin FPSpread.vaSpread vaSpread1
	... 
	SpreadDesigner  =   "Form1.frx":0000
End

C# code:

public UpgradeHelpers.Spread.FpSpread vaSpread1;

private void InitializeComponent ()
{
	this.vaSpread1 = new UpgradeHelpers.Spread.FpSpread();
	this.vaSpread1.Name = "vaSpread1";
	...
	this.Controls.Add(this.vaSpread1);
}

VB.NET code:

Public WithEvents vaSpread1 As UpgradeHelpers.Spread.FpSpread

Private Sub InitializeComponent()
	...
	Me.vaSpread1 = New UpgradeHelpers.Spread.FpSpread
	Me.vaSpread1.Name = "vaSpread1"
	...
	Me.Controls.Add(Me.vaSpread1)

1.2. To COM Interop

This feature will take the legacy COM control and create an interoperability code wrapper to make it visible from the managed code. This means the control's functionality will remain the same since it will use the same binary, but the resulting application will depend on the legacy control.

Original VB6 code:

Begin FPSpread.vaSpread vaSpread1
	... 
	SpreadDesigner  =   "Form1.frx":0000
End

C# code:

public  AxFPSpread.AxvaSpread vaSpread1;

private void InitializeComponent ()
{
this.vaSpread1 = new AxFPSpread.AxvaSpread();
this.vaSpread1.OcxState = (System.Windows.Forms.AxHost.State) resources.GetObject("vaSpread1.OcxState");
this.vaSpread1.Name = "vaSpread1";
...
this.Controls.Add(this.vaSpread1);
}

VB.NET code:

Public WithEvents vaSpread1 As AxFPSpread.AxvaSpread

Private Sub InitializeComponent()
	Me.vaSpread1 = New AxFPSpread.AxvaSpread
	Me.vaSpread1.Name = "vaSpread1"
	Me.vaSpread1.OcxState = CType(resources.GetObject("vaSpread1.OcxState"), System.Windows.Forms.AxHost.State)
	...
	Me.Controls.Add(Me.vaSpread1)

2. MSDataGridLib

2.1. To System.Windows.Forms.DataGridView

Map Microsoft's MSDataGridLib to DataGridView from Windows.Forms.

Original VB6 code:

Private Sub Form_Load()
    Dim ctl As DataGrid
    Set ctl = DataGrid1
    MsgBox(ctl.Columns(1).Text)
End Sub

C# code:

private void Form_Load()
{
	DataGridView ctl = DataGrid1;
	MessageBox.Show(ctl.CurrentRow.Cells[ctl.Columns[1].Name].Value.ToString(), AssemblyHelper.GetTitle(System.Reflection.Assembly.GetExecutingAssembly()));
}

VB.NET code:

Private Sub Form_Load()
	Dim ctl As DataGridView = DataGrid1
	MessageBox.Show(ctl.CurrentRow.Cells(ctl.Columns(1).Name).Value.ToString(), My.Application.Info.Title)
End Sub

2.2. To ComponentOne True DBGrid

Map Microsoft's MSDataGridLib to Component1's C1.Win.C1TrueDBGrid.

Original VB6 code:

Private Sub Form_Load()
    Dim ctl As DataGrid
    Set ctl = DataGrid1
    MsgBox(ctl.Columns(1).Text)
End Sub

C# code:

private void Form_Load()
{
	C1.Win.C1TrueDBGrid.C1TrueDBGrid ctl = DataGrid1;
	MessageBox.Show(ctl.Columns[1].Text, AssemblyHelper.GetTitle(System.Reflection.Assembly.GetExecutingAssembly()));
}

VB.NET code:

Private Sub Form_Load()
	Dim ctl As C1.Win.C1TrueDBGrid.C1TrueDBGrid = DataGrid1
	MessageBox.Show(ctl.Columns(1).Text, My.Application.Info.Title)
End Sub

2.3. To COM Interop

This feature will take the legacy COM control and create an interoperability code wrapper to make it visible from the managed code. This means the control's functionality will remain the same since it will use the same binary, but the resulting application will depend on the legacy control.

Original VB6 code:

Private Sub Form_Load()
    Dim ctl As DataGrid
    Set ctl = DataGrid1
    MsgBox(ctl.Columns(1).Text)
End Sub

C# code:

private void Form_Load()
{
	AxMSDataGridLib.AxDataGrid ctl = DataGrid1;
	MessageBox.Show(ctl.Columns[1].Text, AssemblyHelper.GetTitle(System.Reflection.Assembly.GetExecutingAssembly()));
}

VB.NET code:

Private Sub Form1_Load(ByVal eventSender As Object, ByVal eventArgs As EventArgs) Handles MyBase.Load
	Dim ctl As AxMSDataGridLib.AxDataGrid = DataGrid1
	MessageBox.Show(ctl.Columns(1).Text, My.Application.Info.Title)
End Sub

3. MSDBGridLib

3.1. To System.Windows.Forms.DataGridView + Helper classes

Map MSDBGridLib to DataGridView using the DataGridViewTrueDB class. Some properties use the UpgradeHelpers.DataGridViewTrueDB helper class.

Original VB6 code:

Private Sub Form_Load()
    ...
    Me.DBGrid1.Caption = "Hello"
    text = Me.DBGrid1.Caption
    Me.DBGrid1.Height = 1800
    Me.DBGrid1.Enabled = False   
End Sub

C# code:

private void Form_Load()
{
	this.DBGrid1.Text = "Hello";
	string text = this.DBGrid1.Text;
	this.DBGrid1.Height = 120;
	this.DBGrid1.Enabled = false;
}

VB.NET code:

Private Sub Form_Load()
	Me.DBGrid1.Text = "Hello"
	Dim text_Renamed As String = Me.DBGrid1.Text
	Me.DBGrid1.Height = 120
	Me.DBGrid1.Enabled = False
End Sub

3.2. To COM Interop

This feature will take the legacy COM control and create an interoperability code wrapper to make it visible from the managed code. This means the control's functionality will remain the same since it will use the same binary, but the resulting application will depend on the legacy control.

Original VB6 code:

Private Sub Form_Load()
    ...
    Me.DBGrid1.Caption = "Hello"
    text = Me.DBGrid1.Caption
    Me.DBGrid1.Height = 1800
    Me.DBGrid1.Enabled = False   
End Sub

C# code:

private void Form_Load()
{
	this.DBGrid1.Caption = "Hello";
	string text = this.DBGrid1.Text;
	this.DBGrid1.Height = 120;
	this.DBGrid1.Enabled = false;
}

VB.NET code:

Private Sub Form_Load()
	Me.DBGrid1.Caption = "Hello"
	Dim text_Renamed As String = Me.DBGrid1.Text
	Me.DBGrid1.Height = 120
	Me.DBGrid1.Enabled = False
End Sub

4. MSFlexGrid

4.1. To DataGridViewFlex helper class

Map Microsoft's MSFlexGridLib to a helper class that extends the System.Windows.Forms.DataGridView component.

Original VB6 code:

Private Sub Form_Load()
    Dim ctl As MSFlexGrid
    Set ctl = MSFlexGrid1
    ctl.ScrollBars = flexScrollBarBoth
    ctl.GridLines = flexGridNone
End Sub

C# code:

private void Form1_Load(Object eventSender, EventArgs eventArgs)
{
	UpgradeHelpers.DataGridViewFlex ctl = MSFlexGrid1;
	ctl.ScrollBars = ScrollBars.Both;
	ctl.CellBorderStyle = DataGridViewCellBorderStyle.None;
}

VB.NET code:

Private Sub Form_Load(ByVal eventSender As Object, ByVal eventArgs As EventArgs) Handles MyBase.Load
	Dim ctl As UpgradeHelpers.DataGridViewFlex = MSFlexGrid1
	ctl.ScrollBars = ScrollBars.Both
	ctl.CellBorderStyle = DataGridViewCellBorderStyle.None
End Sub

4.2. To ComponentOne FlexGrid

Map Microsoft's MSFlexGridLib to Component1's C1.Win.C1FlexGrid.

Original VB6 code:

Private Sub Form_Load()
    Dim ctl As MSFlexGrid
    Set ctl = MSFlexGrid1
    ctl.ScrollBars = flexScrollBarBoth
    ctl.GridLines = flexGridNone
End Sub

C# code:

private void Form1_Load(Object eventSender, EventArgs eventArgs)
{
	C1.Win.C1FlexGrid.C1FlexGrid ctl = MSFlexGrid1;
	ctl.ScrollBars = ScrollBars.Both;
	ctl.Styles.Normal.Border.Style = C1.Win.C1FlexGrid.BorderStyleEnum.None;
}

VB.NET code:

Private Sub Form1_Load(ByVal eventSender As Object, ByVal eventArgs As EventArgs) Handles MyBase.Load
	Dim ctl As C1.Win.C1FlexGrid.C1FlexGrid = MSFlexGrid1
	ctl.ScrollBars = ScrollBars.Both
	ctl.Styles.Normal.Border.Style = C1.Win.C1FlexGrid.BorderStyleEnum.None
End Sub

4.3. To COM Interop

This feature will take the legacy COM control and create an interoperability code wrapper to make it visible from the managed code. This means the control's functionality will remain the same since it will use the same binary, but the resulting application will depend on the legacy control.

Original VB6 code:

Private Sub Form_Load()
    Dim ctl As MSFlexGrid
    Set ctl = MSFlexGrid1
    ctl.ScrollBars = flexScrollBarBoth
    ctl.GridLines = flexGridNone
End Sub

C# code:

private void Form1_Load(Object eventSender, EventArgs eventArgs)
{
	AxMSFlexGridLib.AxMSFlexGrid ctl = MSFlexGrid1;
	ctl.ScrollBars = MSFlexGridLib.ScrollBarsSettings.flexScrollBarBoth;
	ctl.GridLines = MSFlexGridLib.GridLineSettings.flexGridNone;
}

VB.NET code:

Private Sub Form1_Load(ByVal eventSender As Object, ByVal eventArgs As EventArgs) Handles MyBase.Load
	Dim ctl As AxMSFlexGridLib.AxMSFlexGrid = MSFlexGrid1
	ctl.ScrollBars = MSFlexGridLib.ScrollBarsSettings.flexScrollBarBoth
	ctl.GridLines = MSFlexGridLib.GridLineSettings.flexGridNone
End Sub

5. TrueDBGrid

5.1. To .NET component that extends the DataGridView

Convert TrueDBGrid to a .NET helper component that extends the System.Windows.Forms.DataGridView control.

The VBUC currently supports the automatic conversion for version 5.0, 6.0, and 7.0 of this control.

By using this option the converted application will not have any reference to the COM Component and no additional licenses are required.

Similar classes within TrueOLEDBGrid60, TrueDBGrid70, and TrueOLEDBGrid70 are mapped to the associated class in this table.

Original VB6 code:

Begin VB.Form Form1 
...
Begin TrueOleDBGrid70.TDBGrid TDBGrid1 
      Height          =   2775
      Width           =   4935
      Left            =   1920
      TabIndex        =   0
      Top             =   840
...

C# code:

partial class Form1
{
	...
	public  UpgradeHelpers.Windows.Forms.DataGridViewTrueDB TDBGrid1;
	...
	private void  InitializeComponent()
	{
		...
		this.TDBGrid1 = new UpgradeHelpers.Windows.Forms.DataGridViewTrueDB(this.components);
		this.TDBGrid1.Location = new System.Drawing.Point(128, 56);
		this.TDBGrid1.Name = "TDBGrid1";
		this.TDBGrid1.Size = new System.Drawing.Size(329, 185);
    this.TDBGrid1.TabIndex = 0;
		...
	}
}

VB.NET code:

Partial Class Form1
	...
	Public WithEvents TDBGrid1 As UpgradeHelpers.Windows.Forms.DataGridViewTrueDB
	...
	Private Sub InitializeComponent()
		...
		Me.TDBGrid1 = New UpgradeHelpers.Windows.Forms.DataGridViewTrueDB(Me.components)
		Me.TDBGrid1.Location = New System.Drawing.Point(128, 56)
		Me.TDBGrid1.Name = "TDBGrid1"
		Me.TDBGrid1.Size = New System.Drawing.Size(329, 185)
		Me.TDBGrid1.TabIndex = 0
		...

5.2. To ComponentOne TrueDBGrid (.NET version)

Convert TrueDBGrid classes to ComponentOne's TrueDBGrid .NET version.

By using this option the converted application will not have any reference to the COM Component.

Original VB6 code:

Begin VB.Form Form1 
...
Begin TrueOleDBGrid70.TDBGrid TDBGrid1 
      Height          =   2775
      Width           =   4935
      Left            =   1920
      TabIndex        =   0
      Top             =   840
...

C# code:

partial class Form1
{
	...	
	public  C1.Win.C1TrueDBGrid.C1TrueDBGrid TDBGrid1;
	...
	private void  InitializeComponent()
	{
		...
		this.TDBGrid1 = new C1.Win.C1TrueDBGrid.C1TrueDBGrid();
		this.TDBGrid1.Location = new System.Drawing.Point(128, 56);
		this.TDBGrid1.Name = "TDBGrid1";
		this.TDBGrid1.Size = new System.Drawing.Size(329, 185);
		this.TDBGrid1.TabIndex = 0;
		...
	}
}

VB.NET code:

Partial Class Form1
	...
	Public WithEvents TDBGrid1 As C1.Win.C1TrueDBGrid.C1TrueDBGrid
	...
	Private Sub InitializeComponent()
		...
		Me.TDBGrid1 = New C1.Win.C1TrueDBGrid.C1TrueDBGrid
		Me.TDBGrid1.Location = New System.Drawing.Point(128, 56)
		Me.TDBGrid1.Name = "TDBGrid1"
		Me.TDBGrid1.Size = New System.Drawing.Size(329, 185)
		Me.TDBGrid1.TabIndex = 0
		...

5.3. To COM Interop

This feature will take the legacy COM control and create an interoperability code wrapper to make it visible from the managed code. This means the control's functionality will remain the same since it will use the same binary, but the resulting application will depend on the legacy control.

Original VB6 code:

Begin VB.Form Form1 
...
Begin TrueOleDBGrid70.TDBGrid TDBGrid1 
      Height          =   2775
      Width           =   4935
      Left            =   1920
      TabIndex        =   0
      Top             =   840
...

C# code:

partial class Form1
{
	...
	public  AxTrueOleDBGrid70.AxTDBGrid TDBGrid1;
	...
	private void  InitializeComponent()
	{
	...
		this.TDBGrid1 = new AxTrueOleDBGrid70.AxTDBGrid();
		this.TDBGrid1.Location = new System.Drawing.Point(128, 56);
		this.TDBGrid1.Name = "TDBGrid1";
		this.TDBGrid1.OcxState = (System.Windows.Forms.AxHost.State) resources.GetObject("TDBGrid1.OcxState");
		this.TDBGrid1.Size = new System.Drawing.Size(329, 185);
		this.TDBGrid1.TabIndex = 0;
		...
	}
}

VB.NET code:

Partial Class Form1
	...
	Public WithEvents TDBGrid1 As AxTrueOleDBGrid70.AxTDBGrid
	...
	Private Sub InitializeComponent()
		...
		Me.TDBGrid1 = New AxTrueOleDBGrid70.AxTDBGrid
		Me.TDBGrid1.Location = New System.Drawing.Point(128, 56)
		Me.TDBGrid1.Name = "TDBGrid1"
		Me.TDBGrid1.OcxState = CType(resources.GetObject("TDBGrid1.OcxState"), System.Windows.Forms.AxHost.State)
		Me.TDBGrid1.Size = New System.Drawing.Size(329, 185)
		Me.TDBGrid1.TabIndex = 0
		...

6. VSFlexGrid

6.1. To ComponentOne FlexGrid

Map VideoSoft’s VSFlex classes and enums to Component1’s C1FlexGrid equivalents.

The following controls are supported:

  • VSFlexLib

  • VSFlex6

  • VSFlex6Ctl

  • VSFlex6d

  • VSFlex6DAOCtl

  • VSFlex7

  • VSFlex7Ctl

  • VSFlex7d

  • VSFlex7DAOCtl

  • VSFlex7L

  • VSFlex7LCtl

  • VSFlex8

  • VSFlex8Ctl

  • VSFlex8d

  • VSFlex8DAOCtl

  • VSFlex8L

  • VSFlex8LCtl

  • VSFlex8n

  • VSFlex8NCtl

Original VB6 code:

Dim fg As vsFlexGrid
Set fg = vsFlexGrid1

fg.ColAlignment(0) = flexAlignCenterCenter
fg.ColAlignment(1) = flexAlignRightCenter
fg.ColAlignment(2) = flexAlignLeftCenter

C# code:

C1.Win.C1FlexGrid.C1FlexGrid fg = vsFlexGrid1;
 
fg.Cols[0].TextAlign = C1.Win.C1FlexGrid.TextAlignEnum.CenterCenter;
fg.Cols[1].TextAlign = C1.Win.C1FlexGrid.TextAlignEnum.RightCenter;
fg.Cols[2].TextAlign = C1.Win.C1FlexGrid.TextAlignEnum.LeftCenter;

VB.NET code:

Dim fg As C1.Win.C1FlexGrid.C1FlexGrid = vsFlexGrid1
 
fg.Cols(0).TextAlign = C1.Win.C1FlexGrid.TextAlignEnum.CenterCenter
fg.Cols(1).TextAlign = C1.Win.C1FlexGrid.TextAlignEnum.RightCenter
fg.Cols(2).TextAlign = C1.Win.C1FlexGrid.TextAlignEnum.LeftCenter

6.2. To COM Interop

This feature will take the legacy COM control and create an interoperability code wrapper to make it visible from the managed code. This means the control's functionality will remain the same since it will use the same binary, but the resulting application will depend on the legacy control.

Original VB6 code:

Dim fg As vsFlexGrid
Set fg = vsFlexGrid1

fg.ColAlignment(0) = flexAlignCenterCenter
fg.ColAlignment(1) = flexAlignRightCenter
fg.ColAlignment(2) = flexAlignLeftCenter

C# code:

AxVSFlex6.AxvsFlexGrid fg = vsFlexGrid1;

fg.set_ColAlignment(0, VSFlex6.AlignmentSettings.flexAlignCenterCenter);
fg.set_ColAlignment(1, VSFlex6.AlignmentSettings.flexAlignRightCenter);
fg.set_ColAlignment(2, VSFlex6.AlignmentSettings.flexAlignLeftCenter);

VB.NET code:

Dim fg As AxVSFlex6.AxvsFlexGrid = vsFlexGrid1
 
fg.ColAlignment(0) = VSFlex6.AlignmentSettings.flexAlignCenterCenter
fg.ColAlignment(1) = VSFlex6.AlignmentSettings.flexAlignRightCenter
fg.ColAlignment(2) = VSFlex6.AlignmentSettings.flexAlignLeftCenter

Last updated