473,396 Members | 1,892 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

state of an object

How can I easily serialize (and deserial.) the items in a combo box?

Expand|Select|Wrap|Line Numbers
  1.     class Program
  2.     {
  3.         static void Main(string[] args)
  4.         {
  5.             Form1 f = new Form1();
  6.  
  7.             f.comboBox1.Items.Add(new object[] {"Item1", "Item2"});
  8.  
  9.             XmlSerializer XmlSerial = new XmlSerializer(f.comboBox1.Items.GetType());
  10.  
  11.             XmlSerial.Serialize(Console.Out, f.comboBox1.Items);
  12.         }
  13.     }
  14.  
It doesn' t work. And when I make it, I suppose I have to save the stream in a file, not in the Console output. What has to be this file, xml??
Jul 27 '09 #1
1 1461
GaryTexmo
1,501 Expert 1GB
Here's the link to the XML Serialization tutorial I followed when I was looking into this...
http://www.devhood.com/Tutorials/tut...utorial_id=236

I found it worked great and had no problems at all. The example near the bottom shows you how to write to a file.

As for the actual serialization... what error does it give you? I would have thought it would work, at least on my first glance at it.
Jul 27 '09 #2

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

Similar topics

0
by: Emil Stoev | last post by:
Howdy eXperts! I have this problem w/ my ASP.NET control. The control is a menu with the following structure: Menu Group 1 Item 1 Item 2 Item 3
1
by: Johan Nedin | last post by:
Hello! I have a problem with SQLSession state on my ASP.NET pages. SQLSession state behaves very different from InProcess session state, which I think is very bad. I can understand some of...
1
by: Tim | last post by:
Could anyone tell me what this means and how do I correct it. Any suggestions? Thanks! Tim Richardson IT Developer and Consultant www.paladin3d.com Unable to serialize the session state. In...
0
by: none | last post by:
Hi, I've got a problem with losing session state in ASP.NET version 2. It does it intermittently - sometimes it tanks - and sometimes it works OK. I've got the ASP.NET state service started...
4
by: Shawnk | last post by:
This post is intended to verify that true value semantics DO NOT EXIST for the Enum class (relative to boolean operations). If this is true then (thus and therefore) you can not design state...
9
by: cashdeskmac | last post by:
I have put a string into Session and tried to retrieve it on the next page I visit but the Session appears empty. I have exactly the same spelling for both adding and retrieving the value: ...
0
ADezii
by: ADezii | last post by:
In Tip #12, we showed how to display a Progress Meter within Access by using the SysCmd() Function. By using this same Function, with different Action Arguments, we will now demonstrate how you can...
4
weaknessforcats
by: weaknessforcats | last post by:
Design Patterns – State Often computer software operates based on a condition called a state. These states traditionally have been implemented using a switch statement. The cases of the switch...
0
by: =?Utf-8?B?SkhhbGV5?= | last post by:
Our system is: IIS Server: dual Intel Xeon 2.80 GHz, 4 GB Ram Windows Server 2003 SP2 IIS 6.0 SQL Server: dual Intel Xeon 2.80 GHz, 4 GB Ram (separate server) Windows Server 2003 SP2 SQL...
1
by: W Karas | last post by:
Virtual functions could have multiple definitions, for different object states. The prototype of a virtual member function could have an optional reserve word "for" followed by a comma-separated...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
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...

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.