473,378 Members | 1,622 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,378 software developers and data experts.

Saving complex properties of a windows forms component into a XML file (like Image,TabPage,etc.)?

Hello,

I'm trying to save some properties of some windows controls into a XML File.

Most of the properties work when I save them as String
(TypeConverter.ConvertToString). But some complex properties like image,
collections such as tabpage's cannot done with this method.

Anybody can help me on how to save and later restore the complex properties?

Thanks in advance...

Regards,

Özden
Nov 20 '05 #1
3 1501
Ozden,

I would try and use serialization to do this. You can use a
SoapFormatter to do this. The drawback to this is that the object has to be
marked as serialized. If this is not the case, you can try and use the
XmlFormatter. The drawback to this though is that it will only serialize
public properties, and some objects can not have their state fully restored
by just having the public properties set. For example, image data isn't
exposed publically (the raw bytes).

In these cases, you are going to have to serialize the data yourself in
some manner.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Özden Irmak" <oz********@isnet.net.tr> wrote in message
news:up**************@TK2MSFTNGP12.phx.gbl...
Hello,

I'm trying to save some properties of some windows controls into a XML File.
Most of the properties work when I save them as String
(TypeConverter.ConvertToString). But some complex properties like image,
collections such as tabpage's cannot done with this method.

Anybody can help me on how to save and later restore the complex properties?
Thanks in advance...

Regards,

Özden

Nov 20 '05 #2
Hi,

Image for example support ISerializable so it should be easy to serialize
it.

The problem are controls that do not support ISerializable , in fact all
controls has MarshalByRefObject in the inheritance line so they are not
serializables, you will have to do a custom serialization for them.

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Özden Irmak" <oz********@isnet.net.tr> wrote in message
news:up**************@TK2MSFTNGP12.phx.gbl...
Hello,

I'm trying to save some properties of some windows controls into a XML File.
Most of the properties work when I save them as String
(TypeConverter.ConvertToString). But some complex properties like image,
collections such as tabpage's cannot done with this method.

Anybody can help me on how to save and later restore the complex properties?
Thanks in advance...

Regards,

Özden

Nov 20 '05 #3
Cor
Hi Ozden,

Why do you not just look to the RESX files which are created when you use
the designer with VB.net forms and/or C# forms.

You have to open it and than look to it in the XML view.

If you use the imagelist from the designer on your form with some pics in it
you see also images

I hope this helps?
Cor
I'm trying to save some properties of some windows controls into a XML File.
Most of the properties work when I save them as String
(TypeConverter.ConvertToString). But some complex properties like image,
collections such as tabpage's cannot done with this method.

Anybody can help me on how to save and later restore the complex properties?
Thanks in advance...

Regards,

Özden

Nov 20 '05 #4

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

Similar topics

4
by: Michael Kennedy [UB] | last post by:
Hi Everyone, I have this multithreaded C# windows forms application which does a lot of image processing. Occasionally, I get the following error: A generic error occurred in GDI+....
10
by: Sunny | last post by:
Hi, I have an old problem which I couldn't solve so far. Now I have found a post in that group that gave me an idea, but I can not fully understand it. The problem is: I'm trying to use a...
4
by: Özden Irmak | last post by:
Hello, I'm trying to save some properties of some windows controls into a XML File. Most of the properties work when I save them as String (TypeConverter.ConvertToString). But some complex...
3
by: cdj | last post by:
Hi all, I've got a picturebox on a form, and a save button. When I go to save, the app craps out with the following error: ================== An unhandled exception of type...
3
by: Martin Montgomery | last post by:
I have, for example, a property called myProperty. I would like, when using a property grid to display the property name as "My Property". Is this possible. Is there an attribute etc Thank ...
4
by: melanieab | last post by:
Hi, I'm trying to save a bitmap file so I can print it later. I have Image.Save("sImage.bmp",System.Drawing.Imaging.ImageFormat.Bmp); The file sImage.bmp shows up in the bin\debug folder but...
2
by: Lance | last post by:
I want to be able to reset a complex property in a PropertyGrid. I know that for properties that are ValueTypes you can include System.ComponentModel.DefaultValue in the declaration of the property....
2
by: steve | last post by:
Hi All I have a program which takes photos of members using a web cam, then saves them as bitmap files The bitmap is used by a Picturebox to display the photo and clicking on a button enables...
0
by: AxOn | last post by:
Hi! I'm having trouble creating a save funktion. How can I save the contens of a new richTextBox that is created from an "external" class file? The open funktion looks like this: public void...
6
by: Jeff | last post by:
Hey (and thank you for reading my post) In visual web developer 2005 express edition I've created a simple website project.. At this website I want users who register to be able to upload a...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.