K S Reddi Prasad

K S Reddi Prasad

  • NA
  • 28
  • 75.3k

Problem with RichTextBox's .rtf property

Apr 18 2011 7:28 AM
Hi all,
 
  I am having a problem with the Richtextbox's .rtf property.

  In my form, I am having a dropdownlist and a Richtextbox. I am getting the items of Dropdownlist dynamically and these values are in fact the elements of an xml file. whenever i select any item, corresponding value of that item(element in xml) is to be displayed in RichText box.

 for that i had coded like this:

    XDocument xmlDocument = XDocument.Parse(xmlPath);
  var DropDowns = from DropDown in xmlDocument.Descendants("Item")
  select new
  {
  Item = DropDown.Element("Text").Value,
  Value = DropDown.Element("Value").Value
  };
  foreach (var DropDown in DropDowns)
  {
  if (selectedText == DropDown.Item)
  {
  rtbReuseData.Rtf= xElement.Element(DropDown.Value).Value;
  }



  Now, I am getting a message such that "Invalid File Format". Here I can also take .text instead of .Rtf, but i want exact format of Text.

PLease  help me in solving this.....



Thanks & Regards,
K.S.R. Prasad.


Answers (1)