Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

how to assign image to windows forms picture control at run time

Posted on 2006-11-08
3
306 Views
Last Modified: 2008-03-03
Hi,
I need sample code that show me how to assign images to picture control(or any other control I don't know)
at program runtime so that I can inser article of data that the images will be part of it.
any help is welcomed

Rgards
Hatem
0
Comment
Question by:shang3000
3 Comments
 
LVL 6

Expert Comment

by:Roopesh_7
ID: 17902393
0
 
LVL 85

Assisted Solution

by:Mike Tomlinson
Mike Tomlinson earned 200 total points
ID: 17902547
Simply?...

    pictureBox1.Image = Image.FromFile(@"c:\someImage.bmp");
0
 
LVL 13

Accepted Solution

by:
iHadi earned 300 total points
ID: 17904038
It depends on where your image resides:

            // from another picturebox
            pictureBox1.Image = pictureBox2.Image;

            // from a file, load the image to memory then to picturebox
            System.Drawing.Bitmap bmp = new System.Drawing.Bitmap  (@"C:\a.jpg");
            // from an image in memory
            pictureBox1.Image = bmp;

0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question