A long time ago I wrote code to insert an image into a RichTextBox.
Haven't used it for years until I tried recently and got an error mesage.
Downloaded new and simpler code to do it. And got the same error as my code.
Looks like the RichTextBox has changed.
Here is one code I used:
Here is the error message:
Haven't used it for years until I tried recently and got an error mesage.
Downloaded new and simpler code to do it. And got the same error as my code.
Looks like the RichTextBox has changed.
Here is one code I used:
VB.NET:
Dim q As Drawing.Image = GetImageResource(resourceName)
Dim bmp As New Bitmap(q)
Dim ms As New MemoryStream()
bmp.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp)
Dim bmpBytes As Byte() = ms.GetBuffer()
Dim str As String = Encoding.ASCII.GetString(bmpBytes)
RichTextBox1.SelectedRtf = "{\rtf1\ansi\ansicpg1252\deff0{\fonttbl{\f0\fnil\fcharset0 Microsoft Sans Serif;}}\viewkind4\uc1\pard\f0\fs20 " & str & "\par}"
Here is the error message:
Last edited by a moderator: