How to assign image on a button at runtime

  • Thread starter Thread starter Kalim Julia
  • Start date Start date
If you want to get an image from your hard disk just use:

Button1.Image = Image.FromFile("c:\1.jpg")

If it's an Embedded Resource you can get it from the Assembly

Dim p As System.Reflection.Assembly
p = System.Reflection.Assembly.GetExecutingAssembly()
Button1.Image = Image.FromStream(p.GetManifestResourceStream(Me.GetType(),
"1.jpg"))

Hth

Greetz Peter and happy holidays
 
Hi,

In addition to Peter's comments note that the image property of a
button will not work when you are using xp visual styles.

Ken
----------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top