473,322 Members | 1,345 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,322 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 15 '05 #1
4 1364
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 15 '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 15 '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 15 '05 #4
Hello,

Thank you all for your great advices...

Regards,

Özden

"Cor" <no*@non.com> wrote in message
news:et**************@TK2MSFTNGP12.phx.gbl...
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 15 '05 #5

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...
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...
3
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...
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....
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: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.