try abc

try abc

  • NA
  • 199
  • 410.1k

problem in appending (.wri)wordpad file

May 2 2008 5:49 AM
    hello everyone..

In my c# project I want to paste rtf text to wordpad from clipboard.I am using streamwriter for that.

I have three richtextbox and I am able to paste only first textbox data not others.

here is my code please help me...

Code: ( text )
  1. StreamWriter sw = new StreamWriter("wpreview.wri");
  2.  
  3.                     for (int i = 0; i < count; i++)
  4.                     {
  5.                         child = clpbrd_panel.Controls["chkbox" + i];
  6.                         if (child != null)
  7.                         {
  8.                             if (((CheckBox)child).Checked == true)
  9.                             {
  10.                                 child = clpbrd_panel.Controls["rtextbox" + i];
  11.                                 ((RichTextBox)child).SelectAll();
  12.                                 ((RichTextBox)child).Copy();
  13.                                 idata = Clipboard.GetDataObject();
  14.                                
  15.                            
  16.                                 if (idata.GetDataPresent(DataFormats.Rtf))
  17.                                 {
  18.                                  
  19.                                                                                       sw.Write(idata.GetData(DataFormats.Rtf));
  20.                                       sw.WriteLine("");
  21.                                    
  22.                                 }
  23.                          }
  24.                 }
  25. sw.close();