Solved

Picture to a command button

Posted on 2000-05-09
15
248 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
Comment Utility
Got to set the .Style to graphical for anything to show up...

M
0
 
LVL 32

Expert Comment

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

Expert Comment

by:GivenRandy
Comment Utility
Why not use a PictureBox instead?
0
 
LVL 12

Expert Comment

by:mark2150
Comment Utility
bhess1 - too slow! :-)

M
0
 

Expert Comment

by:trick_jc
Comment Utility
*******  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
Comment Utility
mark2150 - Well, neener to you, too! ;)
0
 

Expert Comment

by:visualfool
Comment Utility
I think i saw something at http://616.org
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 32

Expert Comment

by:Erick37
Comment Utility
??
trick:

command1.style = 1

Read only, isn't it?
0
 
LVL 12

Expert Comment

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

M
0
 

Expert Comment

by:cys050200
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Thank you!

M
0
 
LVL 32

Expert Comment

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

Author Comment

by:especht
Comment Utility
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

772 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

10 Experts available now in Live!

Get 1:1 Help Now