Solved

Design-Time Properties in an OCX

Posted on 1998-07-24
5
255 Views
Last Modified: 2010-05-03
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?

0
Comment
Question by:percosolator
  • 3
  • 2
5 Comments
 
LVL 7

Accepted Solution

by:
kamall earned 100 total points
ID: 1466623
percosolator,
    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.
Regards
0
 
LVL 2

Author Comment

by:percosolator
ID: 1466624
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?
0
 
LVL 7

Expert Comment

by:kamall
ID: 1466625
>> 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.
0
 
LVL 2

Author Comment

by:percosolator
ID: 1466626
Kamall,

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.

0
 
LVL 7

Expert Comment

by:kamall
ID: 1466627
percosolator,
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.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now