473,769 Members | 6,160 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

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 1383
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.co m

"Özden Irmak" <oz********@isn et.net.tr> wrote in message
news:up******** ******@TK2MSFTN GP12.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 MarshalByRefObj ect 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********@isn et.net.tr> wrote in message
news:up******** ******@TK2MSFTN GP12.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******** ******@TK2MSFTN GP12.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
48240
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+. System.Runtime.InteropServices.ExternalException: A generic error occurred in GDI+. at System.Drawing.Image.Save(String filename, ImageCodecInfo encoder, EncoderParameters encoderParams)
10
7369
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 Windows.Forms.UserControl in a COM environment, i.e. I want to host that control in a COM host. So far, so good, I can host it, but I can not reach the parent COM object from the control (Parent property is null :( ). I have stopped the control in the...
3
3627
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 'System.Runtime.InteropServices.ExternalException' occurred in system.drawing.dll
3
5078
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 Martin
4
2291
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 when I try to print it (or open it), it's completely black. I know Image is the correct picture because when I immediately print it, it works. What am I doing wrong? Thanks! Melanie
3
1527
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 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?
2
4840
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. But, for complex property types (e.g., instance types) this does not work because System.ComponentModel.DefaultValue requires a constant value In order to indicate if a property should be serialized you can include a boolean function named...
0
2390
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 openFile() { OpenFileDialog openFileDialog1 = new OpenFileDialog(); openFileDialog1.Title = "Select a Text File";
6
8124
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 picture of themselves to their profile... I admit that I'm a newbie... but this is how I understand this:
0
9589
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
10045
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...
0
9863
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...
1
7409
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5299
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
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3959
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
3562
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
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.