none
Need to know about the kind(button, textbox, list or combo) of .NET control after custom based serialization? RRS feed

  • Question

  • Hello,

    In the process of serializing .NET control object to custom object( sayMyControlObject) to the other process for some purpose , I need to re-draw these controls in custom manner. For that I need to know what type it is like ( its is button, textbox, combo box, TextField, Calander, ToolStrip,TtoolstripMenu,RichTextBox,TabControl or TreeView it is). For that I might need sort of typeOf(RichTextBox) == RichTextBox sort of check.

    I will be very obliged and thankfull , if any body having idea about this?

    Regards Usman

    Wednesday, May 18, 2011 3:48 PM

Answers

  • If the object is serialized to xml format:

     

    <?xml version="1.0"?>

    <MyClass xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">

      <i>100</i>

      <str>stringvalue</str>

    </MyClass>

     

     you may retrieve its type information by parsing the raw xml stream;

     

    You can also customize xml serialization/deserialization progress, put type information into the xml stream, and read type information when deserializing.


    Eric Yang [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by eryang Friday, May 27, 2011 6:40 AM
    Thursday, May 19, 2011 8:20 AM