Design-Time Properties in an OCX

I have an OCX made from a 'TextBox' control provided with VB.  

I recently wanted to add an alignment property to this control.  

The problem that I am encountering is that when I go to compile, VB says, "Can't Assign to Read-Only Property" because, to the embedded TextBox control, it _is_ runtime, even though, to the OCX it is design time.

The actual statement is this:

Public Property Let Alignment(A As AlignmentConstants)
    Text1.Alignment = A
End Property

The compile stops cold, with "Alignment" highlighted.

The question is:  How do you alter run-time, read-only properties in component controls of an OCX?

Who is Participating?
    You can not alter run-time read-only properties of a VB control embeded into your ActiveX control even though you are using your OCX in the design environment.
    The solution is either to use another control that enables setting the alignment property at run-time, or you manipulate the text alignment in the text box using your own code, which is a little bit complicated.

Hope that helps.
percosolatorAuthor Commented:
I found someone elses solution about using multiple text boxes, not an elegant solution, but I'll use it if I can't find an alternative.

Are you (or is anyone) aware of an API that might help?
>> Are you (or is anyone) aware of an API that might help?

Unfortunately, NO. I have no idea on how to do this using API.
percosolatorAuthor Commented:

I was looking around and saw that "C" I gave you.  Sorry about that, doesn't appear to be any way around this issue.  

I will give you a better one next time, k? Got a couple lurking about that I have been tempted to post, but I always love a good challenge.

Thank you for your comment, and don't worry about the 'C' grade.
I am here to help you and the other people.
Have a nice day.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.