-
I have a toolbar with a GO sign on one of the buttons. When you click it, I want it to change to a STOP sign. I have both images in the imagelist, but cannot figure out the code to change the GO sign to a STOP sign. Here is what I have:
If startstop% = 1 Then
Toolbar1.Buttons(10).ToolTipText = "Start Execution"
Toolbar1.Buttons(10).Image = ImageList1.ListImages(10)
ElseIf startstop% = 2 Then
Toolbar1.ToolTipText = "Stop Execution"
Toolbar1.Buttons(10).Image = ImageList1.ListImages(14)
End If
But this is giving me Run Time error 35603 'Invalid Key'
What am I doing wrong?? Thanks for any help.
-
Why don't you have two toolbar buttons with the different images and make only one visible at a time.
When one is pressed make it invisible and the other visible.
-
Damn Stevie, just beat me to it!
//Anders
-
Gotta be quick round here mate, happens to me all the time. :D
-
You got an Invalid Key error because you did not specify a Key for the ListImage.
Code:
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
If Button.Key = "Stop" Then
Button.Image = ImageList1.ListImages(2).Key
End If
End Sub