Results 1 to 4 of 4

Thread: ActiveX Question

  1. #1

    Thread Starter
    Registered User Virus00110's Avatar
    Join Date
    Jul 2002
    Location
    Williamsport, PA
    Posts
    290

    Question ActiveX Question

    I'm creating a control with command buttons and I want to allow the user to be able to change the Style of the button. I thought that I had everything set right in my code but each time I go to test it, it says that "You can't assign to a read-only property" I have the Get/Let properties setup the same way that I have the appearance property setup and that works fine so if anyone could shed some light on this I would really appreciate it. I'm including the code so you can see what I'm doing right/wrong

    Public Property Get BtnStyle() As ButtonConstants
    BtnStyle = btn.Style 'Gets the command button style.
    End Property

    Public Property Let BtnStyle(ByVal NewStyle As ButtonConstants)
    'Sets the command button style to either (0-Standard) or
    '(1-Graphic). Then changes the property.
    btn.Style = NewStyle
    UserControl.PropertyChanged "BtnStyle"
    End Property

  2. #2
    Member
    Join Date
    Feb 2001
    Location
    Greensboro, NC.
    Posts
    40
    The button style property is read only at run time. It cannot be changed unless you are in design mode.

    Ragards

  3. #3

    Thread Starter
    Registered User Virus00110's Avatar
    Join Date
    Jul 2002
    Location
    Williamsport, PA
    Posts
    290

    Still Confused

    So is there a way that I can set it? The error occurs when I go to put the control I'm creating on a form.

  4. #4
    Member
    Join Date
    Feb 2001
    Location
    Greensboro, NC.
    Posts
    40
    Basically no. All I know to do is set up multiple buttons with preformatted styles, then toggle between them. There is a post out there that has some code attached that might help.
    It is titled: changing button styles runtime

    Perhaps someone else has some ideas?

    Regards

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width