Click here to Skip to main content
15,891,033 members
Home / Discussions / C#
   

C#

 
QuestionFinding controls inside a region ? Pin
kkadir20-Dec-06 1:51
kkadir20-Dec-06 1:51 
Questionuploaf files using desktop applications Pin
Mridang Agarwalla20-Dec-06 1:15
Mridang Agarwalla20-Dec-06 1:15 
AnswerRe: uploaf files using desktop applications Pin
Eitsop20-Dec-06 2:37
Eitsop20-Dec-06 2:37 
GeneralRe: uploaf files using desktop applications Pin
Mridang Agarwalla20-Dec-06 9:36
Mridang Agarwalla20-Dec-06 9:36 
QuestionXmlSerialier reflection error ?? Pin
babbelfisken20-Dec-06 1:00
babbelfisken20-Dec-06 1:00 
AnswerRe: XmlSerialier reflection error ?? Pin
Eitsop20-Dec-06 2:42
Eitsop20-Dec-06 2:42 
GeneralRe: XmlSerialier reflection error ?? Pin
babbelfisken20-Dec-06 3:05
babbelfisken20-Dec-06 3:05 
GeneralRe: XmlSerialier reflection error ?? Pin
Eitsop20-Dec-06 4:09
Eitsop20-Dec-06 4:09 
I have tried out this code. This ignores the button altogether and seems to work just fine:

using System;
using System.IO;
using System.Xml.Serialization;
using System.Windows.Forms;

namespace SerialTest
{
  // This is the class that will be serialized. 
  public class Group
  {
    [XmlIgnoreAttribute]
    public System.Windows.Forms.Button myButton;

    // a group name or something
    public string GroupName;

    // a comment of some sort...
    public string Comment;

    public void SerializeObject(string filename)
    {
	// Create an XmlSerializer instance.
	XmlSerializer xSer = new XmlSerializer(typeof(Group));

	// Writing the file requires a TextWriter.
	TextWriter writer = new StreamWriter(filename);

	// Serialize the object and close the TextWriter.
	xSer.Serialize(writer, this);
	writer.Close();
    }
  }
}


To run this the example I used was a form with a button and the following code on the OnClick event:

Group a = new Group();
a.Comment="A sample comment";
a.GroupName="A sample group name";
a.myButton = this.button1;
a.SerializeObject("c:\\test.xml");


That worked.

- Eitsop

What we do not understand we do not possess. - Goethe.

GeneralRe: XmlSerialier reflection error ?? Pin
babbelfisken20-Dec-06 6:54
babbelfisken20-Dec-06 6:54 
GeneralRe: XmlSerialier reflection error ?? Pin
Member 1488660210-Jul-20 20:35
Member 1488660210-Jul-20 20:35 
AnswerRe: XmlSerialier reflection error ?? Pin
DavidNohejl21-Dec-06 0:34
DavidNohejl21-Dec-06 0:34 
QuestionNo Dll dependant Pin
overfreeze20-Dec-06 0:29
overfreeze20-Dec-06 0:29 
AnswerRe: No Dll dependant Pin
beatles169220-Dec-06 2:18
beatles169220-Dec-06 2:18 
Questioncheck for connection establishment using .Net Remoting Pin
Praveen Raghuvanshi20-Dec-06 0:19
professionalPraveen Raghuvanshi20-Dec-06 0:19 
QuestionStack Class Pin
saymajum20-Dec-06 0:10
saymajum20-Dec-06 0:10 
AnswerRe: Stack Class Pin
althamda20-Dec-06 0:12
althamda20-Dec-06 0:12 
GeneralRe: Stack Class Pin
ednrgc20-Dec-06 7:25
ednrgc20-Dec-06 7:25 
AnswerRe: Stack Class Pin
stancrm20-Dec-06 0:23
stancrm20-Dec-06 0:23 
AnswerRe: Stack Class Pin
User 665820-Dec-06 2:10
User 665820-Dec-06 2:10 
Questionreference to webservice Pin
fmardani19-Dec-06 23:45
fmardani19-Dec-06 23:45 
AnswerRe: reference to webservice Pin
Chris Buckett22-Dec-06 2:58
Chris Buckett22-Dec-06 2:58 
QuestionHow to show a form in another form(not using mdiParent property ) or another control and get events (i.e activated, enter)? Pin
joeblack_mysterious19-Dec-06 23:38
joeblack_mysterious19-Dec-06 23:38 
AnswerRe: How to show a form in another form(not using mdiParent property ) or another control and get events (i.e activated, enter)? Pin
Larantz19-Dec-06 23:46
Larantz19-Dec-06 23:46 
GeneralRe: How to show a form in another form(not using mdiParent property ) or another control and get events (i.e activated, enter)? Pin
joeblack_mysterious20-Dec-06 0:23
joeblack_mysterious20-Dec-06 0:23 
GeneralRe: How to show a form in another form(not using mdiParent property ) or another control and get events (i.e activated, enter)? Pin
Larantz20-Dec-06 9:18
Larantz20-Dec-06 9:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.