Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > Interface and Graphics > [Q] How to copy image from Picturebox into RichTextbox

Thread Tools Display Modes
Old 12-18-2002, 09:03 AM
dtt_vn dtt_vn is offline
Join Date: Dec 2002
Location: Vietnam
Posts: 14
Default [Q] How to copy image from Picturebox into RichTextbox

Hi all.

Please tell me How to copy an image ( from picturebox ) to richtext box? I try to use this code like :

Clipboard.SetData Pic.Image
SendMessage Rich.hWnd, WM_PASTE, 0, 0

But it does not work??? Why??
Reply With Quote
Old 12-18-2002, 09:36 AM
Banjo's Avatar
Banjo Banjo is offline
Hell's Angel

Retired Moderator
* Guru *
Join Date: Jul 2001
Location: Yorkshire, UK
Posts: 10,394

Take a look at this article at EliteVB.
A wise one man once said "what you talking about dog breath"
Reply With Quote
Old 12-19-2002, 12:00 AM
dtt_vn dtt_vn is offline
Join Date: Dec 2002
Location: Vietnam
Posts: 14

Reply With Quote
Old 12-21-2002, 07:15 PM
BryanMiller's Avatar
BryanMiller BryanMiller is offline
Join Date: Dec 2002
Location: KY
Posts: 132

Paste Picture From PictureBox/Clipboard to Rich Text Box

When you will press the button, the picture box's picture will be copied to the clipboard, and from there will be pasted to the rich text box.


Add 1 Command Button (named Command1), 1 Rich Text Box (named RichTextBox1) and 1 Picture Box (named Picture1) to your form.
Add a picture to the Picture Box.

Module Code

Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, _
ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Public Const WM_PASTE = &H302

Form Code

Private Sub Command1_Click()
'the 2 code lines below copy the picture box's picture to the clipboard. if you will omit them,
'the picture that currently found in the clipboard will be copied to the rich text box.
Clipboard.SetData Picture1.Picture
SendMessage RichTextBox1.hwnd, WM_PASTE, 0, 0
Everyone has a photographic memory... some just don't have any film.
Reply With Quote
Old 01-30-2004, 09:25 PM
iloveuall iloveuall is offline
Join Date: Jan 2004
Posts: 4
Question What about vice versa?

I'm eager to know how to copy images from RichTextBox to PictureBox ...
Reply With Quote

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..