Hi
I have a richtextbox and i am adding an image in it. later when i am trying to add a field from listbox into the rich textbox, the image is disappearing.
Ex: I added a logo into my richtextbox. Then i have added a field called Employeename from a listbox. the logo is disappeared and only the field from listbox is visible in it.
Can someone explain me why is it like that and also the solution for this problem
Siddhartha SarkarPosted Oct 10, 2008, 5:53 AM
No Problem man!! I am flattered!
sairamPosted Oct 8, 2008, 12:20 PM
Hi Siddhartha,
Thanks a ton.... U rock man... Bang.... Ur solution is right on the target.
Thanks a ton
Regards
Siddhartha SarkarPosted Oct 8, 2008, 2:32 AM
I meant, it seems you are using the text property of the richtextbox to add the field. May be something like the below line of code is being executed on the button click:
richTextBox1.Text += listBox1.Items[0].ToString();
Am i right? A picture when added to the rich text box is not detected by the text property. You have to use the rtf property of the richtextbox. After pasting the logo in the rich text box find the rtf of the rich text box and you will view a huge rtf code. However no text will be there.
On the button click, try to manipulate the rtf property rather than the text property.
Eg:
Run this code on the button click:
string rtf=richTextBox1.Rtf.Insert( richTextBox1.Rtf.Length-4,"Siddhartha");richTextBox1.Rtf = rtf;
This is just an idea. You need to customize it further according to your needs.
sairamPosted Oct 8, 2008, 2:09 AM
i did nt understand which property means. i just added a bit map in richtextbox. then i selected a listbox field and a button called ADD is pressed, the field in listbox is added to richtext. bcos of this, image is getting disappeared
Siddhartha SarkarPosted Oct 8, 2008, 2:06 AM