Hello good fellows,
I have a resource file in which I save all my controls settings.
It was OK until I did something that somehow disturbed saving of the resources.
When trying to save the file, I get a serialization exception with the error message
"control .....is not marked as serializable".
I can not read the file, as it is probably does not exist (I get reading header error).
The same saving error message is true for any control.
I made the class [Seriizable], made all controls public, but for no avail.
Attached is my method that takes care of saving. It is quite simple.
Thanks
Sam
Loading
FroglegPosted Mar 12, 2012, 4:25 PM
Here is a sample
SamPosted Mar 13, 2012, 11:41 AM
Thanks for your support.
While your reply was correct, there is actually no need to do all that work.
The properties setting are done automatically by opening a ResourceSet (Writer and Reader).
As I wrote, my method worked before I made a change, and I found out that I simply deleted by mistake one word, namely the resource Text property.
Once added, all works fine as follows:
ResourceWriter rw = new ResourceWriter(file);
foreach (Control resource in Controls)
{
if ( resource is NumericUpDown )
{
rw.AddResource(resource.Name, resource.Text);
}
}
rw.Close();