Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Design-Time Properties in an OCX

Posted on 1998-07-24
5
Medium Priority
?
262 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 200 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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

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…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

885 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