I am creating CommandButtons on the fly in my VB code and I am setting the properties when the code creates each button. I want to assign pictures to the buttons (which requires the Style to be set to Graphical (1): the default is Standard (0) ).
So I need to set the Style Property, however, it is read-only at runtime. Is there some way of changing this?
Here is the code I am using
Thanks
Si Fitz
So I need to set the Style Property, however, it is read-only at runtime. Is there some way of changing this?
Here is the code I am using
Code:
Dim strIndex = 0
Set cmdButton = Controls.Add("VB.Commandbutton", "cmdButton" + strIndex, picMain)
With cmdButton
'.Style = 1
' Brings up "Can't assign to read-only property
.Left = intLeft
.Top = intTop
.Picture = picHidden.Picture
.Height = intButtonDim
.Width = intButtonDim
.Tag = strIndex
.Visible = True
End With
Thanks
Si Fitz