Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Store RichTextBox's content in Access 1

Status
Not open for further replies.

duongthaiha

Programmer
Mar 21, 2007
11
0
0
GB
Hi Please help me in these problem. I really do appreciate that.

I am having a richtextbox with the text and image in the contain. The content of the richtextbox is pasted from a word file. Now i have to store that in a Access database.

I have tried with Oleobject but i can not get the oleobject from the richtextbox? There is no
richtextbox.oleobject like some of the article(That make me confuse too :-( )

Can you please tell me how to do it?If there is some line of example code that will be a great help.
Once again thanks in advance.

Best regards
 
You should be able to get the RTF string from the textbox and simply store that in the DB as a string. In terms of the images, you would want to design your DB so you can quickly pull the images back out and re-insert into the rich text box.

I will mention though that RTF is a bit old. You may want to consider something like HTML instead.
 
Thank you very much for you help.I am a bit confuse about what i should do now??

So there is a way to insert the image to it's previous position??

If you want to edit in HTML so what is the best way to to so? Is that mean store the format and the image in html format? The problem that I have to made the richtextbox to be able to edit content as well? Will HTML gonna work with that??

Best regards
 
Ah, if you need to edit the content then a rich text box is probably the easy answer.

You can always save the images to a server and pull the images back when you need them. I think the RTF stores information about the path of the image. If the image exists in the correct path then the image should appear automatically.
 
Thanks once more.

I have test the rtf the rtf will store the image it's self in it. Should i use the type Memo or Oleobject in Access's field??
 
Bwah.... I haven't used access in YEARS.

Do you absolutely have to use access? or can you get MySQL or something similar?

If you are stuck with access then look for something like Binary data...
 
If you really must store the image in Access then one way that may work is convert the image to a byte[] then store the byte array as Memo Type in Access, putting a * between each byte, when you come to remove the image you could then put the memo into a string and do a string.split("*") to get the correct array from it… hope this helps.

Age is a consequence of experience
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top