Rich Text box Copy command not working in web server


The below code is working well in my local machine, but when I upload and test it in a Windows server 2003 (web server) , it is not merging the document.

1 System.Windows.Forms.RichTextBox rTxt1 = new System.Windows.Forms.RichTextBox();
2 System.Windows.Forms.RichTextBox rTxt2 = new System.Windows.Forms.RichTextBox();
4 if (strWordContent == "")
5 {
6 strWordContent = strMyNewWordContent;
7 strFinalWordContent = strWordContent; //Assign the value to the final variable
8 }
9 else
10 {
11 rTxt2.Rtf = strFinalWordContent; //Get the value from the final variable and store it in a 2nd RTF editor
12 strWordContent = strMyNewWordContent;
14 rTxt1.Rtf = strWordContent;
15 string str = rTxt1.Rtf.ToString();
16 int index = str.LastIndexOf('}');
17 string str1 = str.Insert(index, "\page\par
"); //Adding the page break
18 rTxt1.Rtf = str1;
20 rTxt1.SelectAll();
21 rTxt1.Copy();
22 rTxt2.Paste(); //Copy and paste it in the second document.
24 strFinalWordContent = rTxt2.Rtf; // Get the content form 2nd RTF to final variable
26 rTxt2.Clear();
27 rTxt1.Clear();
28 }

My Server Details:

Dot Net Version : 3.5
OS : Windows Server 2003
Office Version : MS Office 2003
Platform : ASP.Net with C#
Application Type : Web application

After statement rTxt2.Paste() is excuted , the previous values is presented in the rTxt2. (the copy and paste command is not working)

Please help on this.

Thanks & regards,
Navaneethakrishnan T


  • you might try something like sticking a doevents inbetween the selectall, copy, and paste statements to allow processing to occur (this is just a guess)

    What are you ultimately trying to accomplish here?

    I often find that if I am having a problem that isn't well documented it is because not many people are running into it. If that is the case then the real underlying issue might be the design or the strategy that I am using to accomplish my ultimate goal.

    If you post what you are ultimately trying to do then there might actually be an all together better solution available.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


In this Discussion