We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

ArrayLists GridControls and Saving Binary

I have an arraylist that is holding gridlist controls. E.g.: Dim dt_StudbookID As New DataTable Dim dr_DRow As DataRow Dim dc_DCol As DataColumn Dim dg_DataGrid As New Syncfusion.Windows.Forms.Grid.GridControl Dim str_X As String = "" dg_DataGrid.RowCount = 0 dg_DataGrid.ColCount = 2 dg_DataGrid(0, 0).Text = "Adrian Lin" dg_DataGrid(0, 1).Text = "1/10/2004" dg_DataGrid(0, 2).Text = "Extraction" al_StudbookID.Add(dg_DataGrid) Which works fine but when I attempt to save the arraylist binary wise: Dim bf_AList As Formatters.Binary.BinaryFormatter Dim fstream_AList As IO.FileStream Dim str_FileNamePathX As String = "" str_FileNamePathX = "C:\Documents and Settings\alin\My Documents\Visual Studio Projects\ZooRisk0.9NGUI\bin\ZRISKFS\Projects\Single Species\Copy of pygmy hippo 7\Scenarios\Baseline\Genetic Storage\IGMATRIXLINEAR" Application.DoEvents() GC.Collect() File.Delete(str_FileNamePathX) bf_AList = New Formatters.Binary.BinaryFormatter fstream_AList = New IO.FileStream(str_FileNamePathX, FileMode.OpenOrCreate, FileAccess.Write) bf_AList.Serialize(fstream_AList, al_StudbookID) fstream_AList.Flush() fstream_AList.Close() FileClose() bf_AList = Nothing fstream_AList = Nothing this is what i get: An unhandled exception of type ''System.Runtime.Serialization.SerializationException'' occurred in mscorlib.dll Additional information: The type Syncfusion.Windows.Forms.Grid.GridControl in Assembly Syncfusion.Grid.Windows, Version=3.0.1.0, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89 is not marked as serializable. I find this confusing since if you do GridControl1.Model.SaveBinary you can save a gridcontol binary. Any help would be great. Thanks,

2 Replies

AD Administrator Syncfusion Team January 27, 2005 02:21 PM UTC

Do not serialize your arraylist of GridControls. Instead, serialize an arraylist of gridControl.Model objects. It is GridModel that is serializable, not GridControl. When reading things back in, take the arraylist of GridModels, and create GridControls using the GridControl constructor that accepts a GridModel.


AL Adrian Lin January 27, 2005 02:28 PM UTC

I see. I''ll give it a shot. Thanks. >Do not serialize your arraylist of GridControls. Instead, serialize an arraylist of gridControl.Model objects. > >It is GridModel that is serializable, not GridControl. When reading things back in, take the arraylist of GridModels, and create GridControls using the GridControl constructor that accepts a GridModel.

Loader.
Live Chat Icon For mobile
Up arrow icon