Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.
Trending News
How do I change the background image of a command button in Visual Basic?
I know how to change it during design time. However, for the sake of a picture-matching game, I need to change the picture during runtime. How do I do it?
Also, how do I set it to (None) during execution?
@Vivek S: I am using VB 6.0 and I want to change the picture of a command button during runtime, WHEN the user clicks the button. So, I don't need those long menus for my program, after all.
3 Answers
- 1 decade agoFavorite Answer
There's a Picture property of Button, so in VB6 for button named CommandButton:
CommandButton.Picture = LoadPicture("c:\\picture.bmp")
You need to change your picture path obviously.
To set it to (none), CommandButton.Picture = Nothing
(Edit)
It's also necessary to set Style property to graphics but I suppose you have already done that during design time. If you didn't:
CommandButton.Style = 1 (Image)
CommandButton.Style = 0 (Standard)
- koczeraLv 45 years ago
To only personalize the introduction of the buttons, less than button homes choose Graphical for type. That way you are able to replace the BG shade upload textual content, and an icon in case you'll like.
- Anonymous1 decade ago
VB.NET
Right click on Button >> Properties >>BackGround >> Local Resource >> select picture