Migration issue from VB6 to VB.Net
-
Hi 1. I migrated vb6 project to vb.net project. 2. The msdatagrid in vb6 is migrated to vb.net axdatagrid 3. while i tried to bind data to that axgrid like ReferenceGrid.DataSource = ds.Tables(0) it shows error as cannot cast ..... 4. Then i used this code to caste it ReferenceGrid.DataSource = CType(ds.Tables(0), msdatasrc.DataSource) 5. still i cannot bind datasource to axgrid getting error as: Unable to cast object of type 'System.Data.DataTable' to type 'msdatasrc.DataSource' 6. Can any one give me code to bind data to converted axdatagrid. -------------------------------------------------------------------------------- chandra shekar thota
-
Hi 1. I migrated vb6 project to vb.net project. 2. The msdatagrid in vb6 is migrated to vb.net axdatagrid 3. while i tried to bind data to that axgrid like ReferenceGrid.DataSource = ds.Tables(0) it shows error as cannot cast ..... 4. Then i used this code to caste it ReferenceGrid.DataSource = CType(ds.Tables(0), msdatasrc.DataSource) 5. still i cannot bind datasource to axgrid getting error as: Unable to cast object of type 'System.Data.DataTable' to type 'msdatasrc.DataSource' 6. Can any one give me code to bind data to converted axdatagrid. -------------------------------------------------------------------------------- chandra shekar thota
You cannot bind a .NET type to the old FlexGrid. Replace the old grid with the DataGridView in the Toolbox and then you can bind that to your .NET DataSet or DataTable object. Of course, if there's other code that manipulates the old grid, you'll have to replace that code with something that does what you need in the DGV.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008 -
You cannot bind a .NET type to the old FlexGrid. Replace the old grid with the DataGridView in the Toolbox and then you can bind that to your .NET DataSet or DataTable object. Of course, if there's other code that manipulates the old grid, you'll have to replace that code with something that does what you need in the DGV.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008Hi Dave, Excellent Answer. I tried to use new grid and confused whether to use Datagrid or DataGridView. I also found all event which are there in VB6 Grid are not there in VB.Net Grids.Please suggest me some thing to implement this. I am looking for add button control in vb.net grid also. Suggest me.
modified on Saturday, December 27, 2008 2:57 AM
-
Hi Dave, Excellent Answer. I tried to use new grid and confused whether to use Datagrid or DataGridView. I also found all event which are there in VB6 Grid are not there in VB.Net Grids.Please suggest me some thing to implement this. I am looking for add button control in vb.net grid also. Suggest me.
modified on Saturday, December 27, 2008 2:57 AM
There is no button in the grid. Normally, you would supply this button seperately and supply an appropriate input form or control to create a new record in the DataSet/DataTable you have the grid bound to.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008