By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,652 Members | 1,337 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,652 IT Pros & Developers. It's quick & easy.

is not marked as serializable

P: 19
i use below code for create arraylist()
Expand|Select|Wrap|Line Numbers
  1.  
  2.  
  3.  Dim ItemsT As New ArrayList()
  4.         If ViewState("items") IsNot Nothing Then
  5.             ItemsT = DirectCast(ViewState("items"), ArrayList)
  6.         Else
  7.             ItemsT = New ArrayList()
  8.         End If
  9.         Dim itemID As Integer = EasyListBoxItemT.SelectedValue
  10.         Dim count As String = TextBoxCount.Text
  11.         Dim Dv As Data.DataView
  12.         Dv = ListData.vag_list_GetItem(itemID).Tables(0).DefaultView
  13.         Dim name As String = Dv.Item(0).Item("name")
  14.         Dim Code As String = Dv.Item(0).Item("Code")
  15.         Dim additem As ItemInf = New ItemInf()
  16.         additem.ID = itemID
  17.         additem.Code = Code
  18.         additem.count = count
  19.         additem.Name = name
  20.         ItemsT.Add(additem)
  21.         ViewState("items") = ItemsT
  22.         TextBoxCount.Text = ""
  23.         EasyListBoxItemT.ClearSelection()
  24.  
  25.  
  26. Public Class ItemInf
  27.     Public itemID As Integer
  28.     Public _Name As String
  29.     Public _Code As String
  30.     Public _count As String
  31.     'Public Sub New(ByVal itemid As Integer, ByVal name As String, ByVal code As String, ByVal count As String)
  32.     '    Me.itemID = itemid
  33.     '    Me._Code = code
  34.     '    Me._count = count
  35.     '    Me._Name = name
  36.     'End Sub
  37.     Public Property ID() As Integer
  38.         Get
  39.             Return itemID
  40.         End Get
  41.         Set(ByVal value As Integer)
  42.             itemID = value
  43.         End Set
  44.     End Property
  45.     Public Property Name() As String
  46.         Get
  47.             Return _Name
  48.         End Get
  49.         Set(ByVal value As String)
  50.             _Name = value
  51.         End Set
  52.     End Property
  53.     Public Property Code() As String
  54.         Get
  55.             Return _Code
  56.         End Get
  57.         Set(ByVal value As String)
  58.             _Code = value
  59.         End Set
  60.     End Property
  61.     Public Property count() As String
  62.         Get
  63.             Return _count
  64.         End Get
  65.         Set(ByVal value As String)
  66.             _count = value
  67.         End Set
  68.     End Property
  69. End Class
  70.  
  71.  
  72.  
But i got this error :
Type 'ItemInf' in Assembly 'App_Code.pnpn31qh, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' is not marked as serializable

any sugestion ??
Feb 8 '09 #1
Share this Question
Share on Google+
2 Replies


10K+
P: 13,264
Well, if at any point in your program you require objects of type ItemInf to be serialized than you need to mark the class ItemInf as serializable.
Feb 9 '09 #2

P: 19
yes i found out i just should add <Serializable()> _ above the class
Feb 9 '09 #3

Post your reply

Sign in to post your reply or Sign up for a free account.