Solved

Picture to a command button

Posted on 2000-05-09
15
249 Views
Last Modified: 2010-05-02
Can anybody tell me how I can add a .jpg or .bmp or .ico to a command button. I have tried the Command1.Picture = Picture1.Picture and also selecting the picture in the command button properties. Nothing has worked. When I run my app, the picture is nowhere to be seen. Can someone please help me? This seems so simple.

I am using VB 6.0.

TIA,
especht
0
Comment
Question by:especht
  • 5
  • 3
  • 2
  • +5
15 Comments
 
LVL 12

Accepted Solution

by:
mark2150 earned 30 total points
ID: 2794369
Got to set the .Style to graphical for anything to show up...

M
0
 
LVL 32

Expert Comment

by:bhess1
ID: 2794372
Change the style property to Graphical on your command button, and the picture will show.
0
 
LVL 9

Expert Comment

by:GivenRandy
ID: 2794375
Why not use a PictureBox instead?
0
 
LVL 12

Expert Comment

by:mark2150
ID: 2794420
bhess1 - too slow! :-)

M
0
 

Expert Comment

by:trick_jc
ID: 2794491
*******  try this ******

command1.style = 1
command1.picture = "picture path"

if you want text just do

command1.text = "Wanted text"

else

command1.text = ""
0
 
LVL 32

Expert Comment

by:bhess1
ID: 2794527
mark2150 - Well, neener to you, too! ;)
0
 

Expert Comment

by:visualfool
ID: 2794529
I think i saw something at http://616.org
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 32

Expert Comment

by:Erick37
ID: 2794633
??
trick:

command1.style = 1

Read only, isn't it?
0
 
LVL 12

Expert Comment

by:mark2150
ID: 2795157
Just set it to "Graphical" on properties page for button. "1" is "graphical"'s value.

M
0
 

Expert Comment

by:cys050200
ID: 2795207
you must change the 'style' to graphical in your form properties.
For example, you have created a button named 'button1", you need to change the 'style' to become graphical, then only import the picture path from the properties.

You can either double click the 'button1' and type the following code:
button1.style = 1  'the style is true
button1.picture= "C:\windows\clouds.bmp"
'just an example of the picture path'

The button1. will change the color with these steps...
0
 
LVL 12

Expert Comment

by:mark2150
ID: 2795854
cys,

Welcome to E-E.

However, as a new member you need to know that it's considered impolite to post an "answer" that is the same as previously posted comments.

If you read the thread you'll see at least *FOUR* experts have given the same "answer" as you - all correct I might add. By posting an "answer" it gives the impression that you're "point grabby" and it does a dis-service to the questioner in that having "answered" his Q you move it from the "Awaiting Answer" category to the "Locked" category and therefore fewer experts will review the question.

Since the questioner can accept any comment as an answer there is no risk that you will "lose" points by posting comments.

M
0
 

Author Comment

by:especht
ID: 2795940
cys,

Like mark2150 explained above, I appreciate your answer, but there were people who proposed the exact same correct answer before you.

mark2150 - I am going to award the points to you for this question. Thank you!

bhess1 - Since you and mark2150 posted the same answer at the exact same time, I will post another question for you to answer and award you 30 points also.

Thanks for all the time and information!

especht
0
 
LVL 12

Expert Comment

by:mark2150
ID: 2796265
Thank you!

M
0
 
LVL 32

Expert Comment

by:bhess1
ID: 2796916
Thank you - you didn't need to do that, but I appreciate it.
0
 

Author Comment

by:especht
ID: 2797416
bhess1,

No problem. It's only fair. Your question can be found at  http://www.experts-exchange.com/jsp/qShow.jsp?ta=visualbasic&qid=10341727

Thanks again!
especht
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

911 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now