473,782 Members | 2,465 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 20 '05 #1
3 1527
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 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 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 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
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
7370
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...
4
1384
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?
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
2292
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
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...
2
4421
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 the camera and another button takes the photo and saves it In VS 2003(VB) all worked fine, but since moving up to VS 2005 (VB) when I try to retake a photo and save it I get error messages
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
8125
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
9641
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
9480
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10313
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10146
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
10080
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
9944
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
8968
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
2
3643
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2875
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.