retrieving text from richtextbox [modified]
-
Hi All, I have a RichTextBox and two buttons placed on the windows form. Where user can type the text he wants, and inserts any picture by clicking "insert picture" button. Whenever he clicks the "EXPORT" button, i want to retrieve all the text from the Richtext box to a string variable. Now, my problem is that, i can save the text but if there is any picture inserted in the message, it is indicating as "space" in the text. I want to insert a special character ( like any character between 127 - 255 in ascii table) in the place of that picture. How could I do that? could any one please guide me.. I'm really lost in this issue since 3 days! :(( Here i'm posting my code here!: pic = ImageSelect.pbSelected[i].Image; InsertImage(pic); private void InsertImage(Image pic) { Bitmap myBitMap = new Bitmap(pic); Clipboard.SetDataObject(myBitMap); DataFormats.Format myFormat = DataFormats.GetFormat(DataFormats.Bitmap); maskedTextBox1.Paste(); if (richTextBox1.CanPaste(myFormat)) { richTextBox1.Paste(myFormat); } else MessageBox.Show("cannot paste"); } private void btnExport_Click_1(object sender, EventArgs e) { //richTextBox1.SaveFile("D:\\b.txt"); strMessage = richTextBox1.Text; MessageBox.Show(strMessage); } Thanks, Durga.
Strength is life, Weakness is death. --- Swami vivekananda
modified on Wednesday, February 20, 2008 1:57 AM