Welcome to Dream.In.Code
Become a VB Expert!

Join 137,233 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 1,792 people online right now. Registration is fast and FREE... Join Now!




changing the image of a label

 
Reply to this topicStart new topic

changing the image of a label

orangeslide8
4 Feb, 2007 - 06:10 PM
Post #1

D.I.C Head
Group Icon

Joined: 29 Dec, 2006
Posts: 190



Thanked: 1 times
Dream Kudos: 25
My Contributions
could i change the image of a label by saying
CODE

Label1.Image = ' Then What would i do here?

User is offlineProfile CardPM
+Quote Post

m2s87
RE: Changing The Image Of A Label
4 Feb, 2007 - 11:23 PM
Post #2

D.I.C Regular
Group Icon

Joined: 28 Nov, 2006
Posts: 390



Thanked: 1 times
Dream Kudos: 1225
My Contributions
QUOTE(orangeslide8 @ 5 Feb, 2007 - 04:10 AM) *

could i change the image of a label by saying
CODE

Label1.Image = ' Then What would i do here?


Try something like:
Me.Label1.Image = CType(resources.GetObject("Label1.Image"), System.Drawing.Image)

Hope it helped biggrin.gif
User is offlineProfile CardPM
+Quote Post

Louisda16th
RE: Changing The Image Of A Label
5 Feb, 2007 - 12:04 AM
Post #3

 
Group Icon

Joined: 3 Aug, 2006
Posts: 1,790



Thanked: 1 times
Dream Kudos: 755
My Contributions
Try this:
CODE

Label1.Image = System.Drawing.Image.FromFile("C:\asdf.bmp")

User is offlineProfile CardPM
+Quote Post

orangeslide8
RE: Changing The Image Of A Label
5 Feb, 2007 - 04:17 AM
Post #4

D.I.C Head
Group Icon

Joined: 29 Dec, 2006
Posts: 190



Thanked: 1 times
Dream Kudos: 25
My Contributions
QUOTE(Louisda16th @ 5 Feb, 2007 - 01:04 AM) *

Try this:
CODE

Label1.Image = System.Drawing.Image.FromFile("C:\asdf.bmp")


where should i store the image to get it from that folder?
User is offlineProfile CardPM
+Quote Post

Louisda16th
RE: Changing The Image Of A Label
5 Feb, 2007 - 06:16 AM
Post #5

 
Group Icon

Joined: 3 Aug, 2006
Posts: 1,790



Thanked: 1 times
Dream Kudos: 755
My Contributions
Which folder? What I meant was this:
CODE

Label1.Image = System.Drawing.Image.FromFile("<put the path of the image file here>")


This post has been edited by Louisda16th: 5 Feb, 2007 - 06:17 AM
User is offlineProfile CardPM
+Quote Post

orangeslide8
RE: Changing The Image Of A Label
5 Feb, 2007 - 07:07 AM
Post #6

D.I.C Head
Group Icon

Joined: 29 Dec, 2006
Posts: 190



Thanked: 1 times
Dream Kudos: 25
My Contributions
QUOTE(Louisda16th @ 5 Feb, 2007 - 07:16 AM) *

Which folder? What I meant was this:
CODE

Label1.Image = System.Drawing.Image.FromFile("<put the path of the image file here>")


k thnx

User is offlineProfile CardPM
+Quote Post

orangeslide8
RE: Changing The Image Of A Label
5 Feb, 2007 - 07:28 AM
Post #7

D.I.C Head
Group Icon

Joined: 29 Dec, 2006
Posts: 190



Thanked: 1 times
Dream Kudos: 25
My Contributions
how do you write a file Path
sry im really bad at it
if the file name is 6 of hearts.tiff and it on my desktop how would i write that file path like this?
[code]
("C:\desktop.6 of hearts.tiff")
i tried that and it didn't work
thnx
john

User is offlineProfile CardPM
+Quote Post

Louisda16th
RE: Changing The Image Of A Label
5 Feb, 2007 - 08:00 AM
Post #8

 
Group Icon

Joined: 3 Aug, 2006
Posts: 1,790



Thanked: 1 times
Dream Kudos: 755
My Contributions
In case of your desktop I think the path will be:

C:\Documents and Settings\<your windows log on name>\Desktop\6 of hearts.tif

Use file extension as "tif" not tiff.

This post has been edited by Louisda16th: 5 Feb, 2007 - 08:01 AM
User is offlineProfile CardPM
+Quote Post

orangeslide8
RE: Changing The Image Of A Label
5 Feb, 2007 - 08:13 AM
Post #9

D.I.C Head
Group Icon

Joined: 29 Dec, 2006
Posts: 190



Thanked: 1 times
Dream Kudos: 25
My Contributions
QUOTE(Louisda16th @ 5 Feb, 2007 - 09:00 AM) *

In case of your desktop I think the path will be:

C:\Documents and Settings\<your windows log on name>\Desktop\6 of hearts.tif

Use file extension as "tif" not tiff.

k thnx

User is offlineProfile CardPM
+Quote Post

orangeslide8
RE: Changing The Image Of A Label
9 Feb, 2007 - 03:05 PM
Post #10

D.I.C Head
Group Icon

Joined: 29 Dec, 2006
Posts: 190



Thanked: 1 times
Dream Kudos: 25
My Contributions
how would you write the path from a project resource ?
User is offlineProfile CardPM
+Quote Post

Louisda16th
RE: Changing The Image Of A Label
9 Feb, 2007 - 07:18 PM
Post #11

 
Group Icon

Joined: 3 Aug, 2006
Posts: 1,790



Thanked: 1 times
Dream Kudos: 755
My Contributions
Suppose pic1 is the name of your resource:
CODE

Label1.Image = My.Resources.pic1


Before asking a question on things like this, I suggest you check out th 'My' object (I think its an object). It got almost everything you require. Just a little searching would do.
smile.gif
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/4/08 03:38PM

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month