I have a string
variable Writer
that recieves xml code from another window
. I need to pass this string
to textWriter
variable but i dont know how to make it readable by textWriter
. I tried to convert it to XmlTextWriter
but it dont seem to work. How can it be accepted by textWriter
?
textWriter = (XmlTextWriter)XmlTextWriter.Create(new StringBuilder(Writer));
XmlTextWriter textWriter;
public Question_Redactor(int k, string Writer)
{
textWriter = new XmlTextWriter(Writer);
InitializeComponent();
}
When the code runs, the following error message is generated:
The system.InvalidCastException: "Unable to cast objects of type" System. Xml. XmlWellFormedWriter "to type" System. Xml. XmlTextWriter"."
Did like jdweng suggested and it worked perfectly