hi to all,
I am having one Problem in update in RTB Control.
Description is as follows:
I am reading a XML File and Showing It inside a RTB Control. When I am Inserting the Text in RTB at the same time I am Changing the Text color of the Text so that It displays diffrent tags of XML in different color.
Requirement:
If I select a text and click on bold Button (Which I created for In RTB to make font Bold). The text is displaying in Bold. But my Requirement is whenever I click on Bold It has to Insert this Text In place of Selected Text i.e.( SelectedText.)
for this I Wrote This Code :
RichTextBox1.SelectedText = "" + RichTextBox1.SelectedText + "";
It is Working Fine But I am having such a requirement like this when I again click on this Bold button these tags ( and ) must removed from the selected text.
for this what I have to write????
Please help me on this issue. Its very urgent.
If requirement is not clear Please let me know..
Thanks in Adavance.
To Show XML File Inside RichTextBox With updation of text capability after clicking a button.
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.

Raaj KumarRank #7,836 · 233 reputationPosted Feb 20, 2010, 1:29 AM EST
Try this code,
if (rtxtXML.SelectionFont.Bold)
{
rtxtXML.SelectionFont = new Font("Verdana", 12, FontStyle.Regular);
}
else
{
rtxtXML.SelectionFont = new Font("Verdana", 12, FontStyle.Bold);
}
Let me know if you want more help
Regards,
Raaj