473,386 Members | 1,810 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

How to assign image on a button at runtime

Anybody knows, How to assign image on a button at runtime
Dec 23 '05 #1
2 6811
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.Ge tType(),
"1.jpg"))

Hth

Greetz Peter and happy holidays
--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce
bigger and better idiots. So far, the Universe is winning. (Rich Cook)
"Kalim Julia" <ka*********@gmail.com> schreef in bericht
news:es*************@TK2MSFTNGP12.phx.gbl...
Anybody knows, How to assign image on a button at runtime

Dec 23 '05 #2
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
----------------
"Peter Proost" <pp*****@nospam.hotmail.com> wrote in message
news:eM*************@tk2msftngp13.phx.gbl...
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.Ge tType(),
"1.jpg"))

Hth

Greetz Peter and happy holidays
--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce
bigger and better idiots. So far, the Universe is winning. (Rich Cook)
"Kalim Julia" <ka*********@gmail.com> schreef in bericht
news:es*************@TK2MSFTNGP12.phx.gbl...
Anybody knows, How to assign image on a button at runtime


Dec 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Mark Kamoski | last post by:
How can one change an image url at runtime? (Note, the image exists in a user control.) This is the image tag on the ascx... <asp:image id="TopBanner" runat="server"></asp:image> ....but...
10
by: Woody Splawn | last post by:
I have a button that I would like to put on a form, actually a panel on a form. The problem is that it's transparency color is magenta and I can not find a way to make the button look right. The...
4
by: Andres | last post by:
Hi all, I have the problem to assign a variable of type object to a specific class at runtime. I want to use a string variable that specify the class a want to set this object. Is something...
2
by: Tommy | last post by:
Hi all, I use DataGridView in my form and add image column and 2 textbox column, and I want to change image column's image on runtime. But there is no any example on this function. What can I do ?...
1
by: vighnesh | last post by:
Hai All Can Anyone Please suggest me how to add an image to a button at runtime using VB/C#.NET . That image has to blick so it has the user attention. Thanks in advance. Regards Vighneswar
3
by: den 2005 | last post by:
Hi everyone, Here is code working on..Trying to insert record with a column with Image or VarBinary datatype in sql database from a existing jpeg image file, then retrieve this image from...
0
by: jcvoon | last post by:
Hi: I'm using VS2005, I add my image into project resource file, and my picture box and button control reference the image from the project resource file, what is the default transparent color...
2
by: PerumalSamy | last post by:
Hi, i had created image button and assigned image url as per the below code imagebutton1.imageurl = server.mappath("photo")+ "\" + imagefilename photo -> image folder in my project...
4
by: Marcolino | last post by:
Hi, I have simple needs but I don't know how to implement it. I have application that create Dynamic Button. I need to set the image on this button, getting the icon from a form. So pratically...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.