For Programmers: Free Programming Magazines  


Home > Archive > Visual Basic > November 2005 > Code to change button style?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Code to change button style?
Lisa Forde

2005-11-25, 7:55 am

Good day. I want to be able to change my button from just having text to
having an image at runtime and I'm wondering if anyone has come across code
to do this. It would be much appreciated.

Thanks


Joe O

2005-11-25, 7:55 am

VB button style property is read-only at runtime. So you have to set your vb
button style to graphical at design time...
Then use loadpicture command to assign a picture to the button

Command1.Picture = LoadPicture("c:\yourpicture.bmp")

"Lisa Forde" <1forde@caribsurf.com> wrote in message
news:11odtmjb7rbvae0@corp.supernews.com...
> Good day. I want to be able to change my button from just having text to
> having an image at runtime and I'm wondering if anyone has come across

code
> to do this. It would be much appreciated.
>
> Thanks
>
>



Lisa Forde

2005-11-25, 6:55 pm

Perfect Mr. O. Thanks. I really have a lot to learn.

"Joe O" <jp3BlessNoSpam@hotmail.com> wrote in message
news:%23oP51Uc8FHA.1484@tk2msftngp13.phx.gbl...
> VB button style property is read-only at runtime. So you have to set your
> vb
> button style to graphical at design time...
> Then use loadpicture command to assign a picture to the button
>
> Command1.Picture = LoadPicture("c:\yourpicture.bmp")
>
> "Lisa Forde" <1forde@caribsurf.com> wrote in message
> news:11odtmjb7rbvae0@corp.supernews.com...
> code
>
>



Kjell

2005-11-26, 6:55 pm

If I really needed to change the style at runtime I would set up two buttons,
one with text and one with Graphic.

maybe it's even possible to do as a control array.

Place both on top of each other, use .Visible to control which to use.

Kjell

"Lisa Forde" wrote:

> Perfect Mr. O. Thanks. I really have a lot to learn.
>
> "Joe O" <jp3BlessNoSpam@hotmail.com> wrote in message
> news:%23oP51Uc8FHA.1484@tk2msftngp13.phx.gbl...
>
>
>

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com