Solved

Design-Time Properties in an OCX

Posted on 1998-07-24
5
257 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

792 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