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.
Unfortunately, activation email could not send to your email. Please try again.

ArrayLists GridControls and Saving Binary

Thread ID:

Created:

Updated:

Platform:

Replies:

24064 Jan 27,2005 09:13 AM Jan 27,2005 09:28 AM Windows Forms 2
loading
Tags: GridControl
Adrian Lin
Asked On January 27, 2005 09:13 AM

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,

Administrator [Syncfusion]
Replied On January 27, 2005 09:21 AM

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.

Adrian Lin
Replied On January 27, 2005 09:28 AM

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.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;