Results 1 to 5 of 5

Thread: How to add a picture in a RTB

  1. #1

    Thread Starter
    Lively Member Arispan's Avatar
    Join Date
    Apr 2010
    Location
    Greece, Near Athens
    Posts
    98

    Question How to add a picture in a RTB

    Hello everyone,

    I am making a program that collects data from the user and then it prints it in a RTB. I can succesfully do this but I want to add a picture in the beggining of the RTB and I don't know to do it. I have the picture in the resources of the project. Can anyone help me?
    MOBO: Asrock X58 Extreme
    CPU : Core i7 950 @ 3.07Ghz
    Ram : 8GB
    Hard Drive : 1.5 TB (1 TB, 500GB)
    Graphics : ATI Radeon HD 5670
    Dual Boot : Windows XP Home, Windows 7 Ultimate x64


    _____________________
    If a reply has helped you, please consider rating it.

  2. #2
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,413

    Re: How to add a picture in a RTB

    try this:

    vb Code:
    1. Clipboard.SetImage(My.Resources.[resourceName])
    2. RichTextBox1.Paste()
    Last edited by .paul.; Dec 15th, 2010 at 09:44 AM.

  3. #3

    Thread Starter
    Lively Member Arispan's Avatar
    Join Date
    Apr 2010
    Location
    Greece, Near Athens
    Posts
    98

    Re: How to add a picture in a RTB

    I tried doing this but it doesn't work. I tried renaming my picture(with no gaps and no .bmp) but it still didn't work.
    MOBO: Asrock X58 Extreme
    CPU : Core i7 950 @ 3.07Ghz
    Ram : 8GB
    Hard Drive : 1.5 TB (1 TB, 500GB)
    Graphics : ATI Radeon HD 5670
    Dual Boot : Windows XP Home, Windows 7 Ultimate x64


    _____________________
    If a reply has helped you, please consider rating it.

  4. #4
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,897

    Re: How to add a picture in a RTB

    Pauls code works for me:

    Code:
            Clipboard.SetImage(My.Resources.Image1) 'Image1 is Image1.jpg in my resources
            RichTextBox1.Paste()
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  5. #5
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,413

    Re: How to add a picture in a RTB

    did you add the picture to my.resources?

    Project-->Properties-->Resources-->Add Resource

    if not you'll need to create a new bitmap + then put that on the clipboard before pasting

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width