473,669 Members | 2,420 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

[Serializable] attribute gives 'Declaration expected' squiggly

I'm binding a datagrid to my business object. I get an error that the type
'abcshoppingcar t'...is not marked as serializable.

So, I added a [Serializable] attribute in the class. But then a blue
squiggly appears with 'declaration expected'. Any idea why?

[Serializable]
Public Class abcshoppingcart
Public customer As New abccustomer
Public product As New List(Of abcproduct)

Public Sub New()
' constructor
End Sub
......
Aug 19 '08 #1
1 2000
FYI: Do it this way....

<Serializable() Public Class xxxxxx

"Cirene" <ci****@nowhere .comwrote in message
news:OW******** ******@TK2MSFTN GP05.phx.gbl...
I'm binding a datagrid to my business object. I get an error that the
type 'abcshoppingcar t'...is not marked as serializable.

So, I added a [Serializable] attribute in the class. But then a blue
squiggly appears with 'declaration expected'. Any idea why?

[Serializable]
Public Class abcshoppingcart
Public customer As New abccustomer
Public product As New List(Of abcproduct)

Public Sub New()
' constructor
End Sub
.....

Aug 19 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
12735
by: Ben Terry | last post by:
I get the following compilation error: "The type or namespace name 'Serializable' could not be found (are you missing a using directive or an assembly reference?)" Can anyone tell me why the following code will not compile? I thought the "Serializable" attribute was located in the System.Runtime.Serialization assembly. I'm trying to stream this structure to/from a byte array. using System.Runtime.InteropServices; using...
0
1447
by: Poewood | last post by:
I am experimenting with saving files in binary format on the Pocket PC. When I use the attribute I get error in Compact Framework. Do i have to use the attribute to make a class serializable? Also if I choose to use XMLSerialization do I use the attribute? Finally, can I save a file in an application built for Pocket PC in a binary format? Than you, Poe
1
2642
by: Frank Rizzo | last post by:
What is the performance impact of setting a attribute on a class? Is there a performance win if I remove the attribute? I am doing some perf profiling and realized that all my strongly type collections generated by CodeSmith have a attribute on them. Thanks
0
2798
by: Joshua Belden | last post by:
I have a class that is marked as Serializable that implements INotifyPropertyChanged. private event PropertyChangedEventHandler _PropertyChanged; public event PropertyChangedEventHandler PropertyChanged { add { _PropertyChanged += value; } remove { _PropertyChanged -= value; } }
1
1073
by: Shail | last post by:
I want to store the value of objects in View Statr but it gives exception that object is not Serializable, I added serializable attribute before the class it didn't work. What must be done? Secondly I want to store the objects value in database, How can it be done? Thanks.
1
2664
by: Harshdeep Mehta | last post by:
Hi all, I have written a page in which I want to preserve value of object - suppose A - value, so I used viewstate. but that give me error. Code : ViewState = objClassA; // Before PostBack objClassA = (ClassA) ViewState // After PostBack Any Body can help me out?
9
3819
by: Developer | last post by:
Hi, How can one tell wsdl.exe/VS.NET web service proxy generatioon to to put on imported classes? For example, i fin your web service you use a class: class Data { }
2
36603
by: Prakash | last post by:
Hi Friends, In my C# application, i have tried to serialize some structured data using Soapformatter. While calling the serialize funciton i got the exception message like "mscorlib....The type <Appname>.<structurename> in Assembly <Appname>, Version=1.0.2162.36249, Culture=neutral, PublicKeyToken=null is not marked as serializable."
2
1070
by: Mark Petruszak | last post by:
I have the following code and I don't understand why I get a "Declaration expected" error for the myPen and formGraphics variables. Imports System.Drawing Public Class ucInfield Dim myPen As New Pen(System.Drawing.Color.Red) Dim formGraphics As Graphics formGraphics = Me.CreateGraphics() formGraphics.DrawLine(myPen, 0, 0, 200, 200)
0
8465
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8809
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8588
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8658
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5682
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4206
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4386
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2797
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1788
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.