Results 1 to 10 of 10

Thread: Why don't all the properties don't show up?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Nov 2000
    Posts
    27

    Why don't all the properties don't show up?

    I'm new to active x controls - this is my first one - I'm trying to create an activex text box control that has more functionality then the standard textbox control. I use the wizard to create my properties but when I use the next control on a form I don't see all of the properties I thought I created. Why is this? For instance, I want the multiline property to be available to the developer but it isn't in the property list. I tried doing the following in the load event of my form

    ctltextbox.multiline = true

    and it gave me an error when I ran the program.

    Compile error: Wrong number of arguments and invalid property assignment.

    Why can't I access this property??

  2. #2
    Hyperactive Member Paul Warren's Avatar
    Join Date
    Jun 2000
    Location
    UK
    Posts
    282
    I know this is obvious but is the property is declared as public ? Can you see any of the new properties you expect to see ?
    That's Mr Mullet to you, you mulletless wonder.

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Nov 2000
    Posts
    27

    Why don't all the properties show up?

    Yes, it is public. Seems the problem stems from the property being design time only. For instance, if I create a standard project and put a text box on my form, I can't change the multiline or scrollbar properties at run time - only at design time. So in my control I can only expose the properties that are allowed at run time. I can't expose any that are design time only. No one seems to know a way around this. Help!!

  4. #4
    Hyperactive Member Paul Warren's Avatar
    Join Date
    Jun 2000
    Location
    UK
    Posts
    282
    Can you post the property Let/Set/Get statements for multiline so I can check them for you ?
    That's Mr Mullet to you, you mulletless wonder.

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Nov 2000
    Posts
    27
    Thanks for your help. I use the Active X Control Interface Wizard and it create the Get property as follows:

    'WARNING! DO NOT REMOVE OR MODIFY THE FOLLOWING COMMENTED LINES!
    'MappingInfo=Text1,Text1,-1,MultiLine
    Public Property Get MultiLine() As Boolean
    MultiLine = Text1.MultiLine
    End Property

    However it doesn't create a Let property for Multiline (or any other design time only properties). I hand coded the following:

    Public Property Let MultiLine(ByVal New_MultiLine As Boolean)
    Text1.MultiLine() = New_MultiLine
    PropertyChanged "MultiLine"
    End Property

    But when I compile I get

    Can't assign to read only property

    on the Text1.Multiline() = New_Multiline

  6. #6
    Hyperactive Member Paul Warren's Avatar
    Join Date
    Jun 2000
    Location
    UK
    Posts
    282
    The answer is that your control consists of a standard VB control which does not allow you to change the Multiline property at runtime. Therefore your code inherits this same feature and so can't change multiline at runtime either. Just because you're building a control of your own doesn't 'open up' the standard controls. Sorry. You'll have to find another way to do it although if the VB version has this restriction then it's not unreasonable for you to have the same one on your control.

    Hope this helps.
    That's Mr Mullet to you, you mulletless wonder.

  7. #7

    Thread Starter
    Junior Member
    Join Date
    Nov 2000
    Posts
    27
    Yes, I understand that I can't change the property at runtime and that my control inherits this same feature and I wouldn't want to open up the standard controls so that the developer could change the property at run time. In mose caes it wouldn't make sense to want to change the property at runtime. However, the developer who is using my control is designing a form with my control on it and they are in design mode - not runtime mode when they want to change it.

    Yes, I understand that because they are using my control they are in actuality running a form with the textbox control on it so they are in runtime mode and that's why they can't access that property.

    So how do I get around this? If I have a text box on my control is there no way to let the developer put a scrollbar on that text box or have the choice of multiline? It seems silly to me that I might have to write code to allow them to do this when the functionality is already inherent in the textbox control.

    I seem to remember seeing something about there being a way to tell if the control I create is being used by the developer or is actually being run so I guess I just hoped there was then a way to say OK it's being used by the developer so let them change that property. But I guess not. Thanks for your help.

  8. #8
    Hyperactive Member Paul Warren's Avatar
    Join Date
    Jun 2000
    Location
    UK
    Posts
    282
    now I understand what you want ! Yes there is a way to do it but I'm really busy just now. Will post back here later, although it might be tomorrow now.
    That's Mr Mullet to you, you mulletless wonder.

  9. #9
    Hyperactive Member Paul Warren's Avatar
    Join Date
    Jun 2000
    Location
    UK
    Posts
    282
    Weeell, I've had a look and asked the other guys in the office and it's our opinion that it's not possible to do it this way. You could create two versions of the control - one multiline, one single line ? It's the only way we've seen it handled before. Sorry I can't be of any more use on this one.
    That's Mr Mullet to you, you mulletless wonder.

  10. #10

    Thread Starter
    Junior Member
    Join Date
    Nov 2000
    Posts
    27
    Thanks for looking into this for me. I had a feeling whatever the solution it wasn't going to be simple! I'm going to post a question to MS and see if they have any suggestions. Seems like this would be something everyone would want to do??? Nice to be able to create your own controls but I guess if it was this easy all those software companies out there writing controls would be out of a job! Thanks again.

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