Results 1 to 4 of 4

Thread: User Control as Property

  1. #1

    Thread Starter
    Lively Member StoneTheCrows's Avatar
    Join Date
    Dec 2004
    Location
    UK
    Posts
    71

    Cool User Control as Property

    I am Having a problem using a UserControl as a Property for another UserControl.

    Scenario:

    ActiveX Library containing UserControls: cDataTable and cDataDisplay

    cDataTable has an array of 100 Variants called Value.
    cDataDisplay Is a kind of Label that will monitor and display ONE Value element from an Instance of cDataTable.

    cDataDisplay has Properties:

    SourceTable as cDataTable with Get and Set Property Procedures
    SourceIndex as Integer with Get and Let Property Procedures

    So, cDataDisplay can access its SourceValue by :
    Code:
     myValue = mySourceTable.Value(mySourceIndex)
    This all works fine if the end user sets the SourceTable property of the cDataDisplay in code in his form load event or somewhere similar.

    However, I do not want the end user to have to do that, I want him to be able to select the Instance of cDataTable for the SourceTable property from a drop down list of cDataTables on his form in the Properties window.

    I have done this successfully in C++ and VB.NET with no special coding beyond the correct Property procedures. Why wont the SourceTable Property display in the Properties window?

    I have tried this every which way I can think of in VB6, but I suspect I am just being thick.

    I would appreciate any helpful comments.
    Last edited by StoneTheCrows; Dec 23rd, 2004 at 07:35 AM.
    StoneTheCrows

    _______________

    The future will be better tomorrow. (George W. Bush)

    (If you think my post was useful, please Rate it. Thanks)

  2. #2

    Thread Starter
    Lively Member StoneTheCrows's Avatar
    Join Date
    Dec 2004
    Location
    UK
    Posts
    71

    Re: User Control as Property

    I haven't resolved this issue yet, but I did find an article by Alan Seedhouse at http://www.vbcity.com/page.asp?f=friends&p=bindctrl which goes a long way towards answering my question.

    Alans solution works well but the exposed property requires the user to type the name of a control from the parent form.

    If anyone reads the article and understands my problem as a result, maybe they can expand on it a little to explain how I can make the property box show a drop down list of the available qualifying controls on the Parent Form.
    StoneTheCrows

    _______________

    The future will be better tomorrow. (George W. Bush)

    (If you think my post was useful, please Rate it. Thanks)

  3. #3
    PowerPoster Dave Sell's Avatar
    Join Date
    Mar 2004
    Location
    /dev/null
    Posts
    2,961

    Re: User Control as Property

    Quote Originally Posted by StoneTheCrows
    I haven't resolved this issue yet, but I did find an article by Alan Seedhouse at http://www.vbcity.com/page.asp?f=friends&p=bindctrl which goes a long way towards answering my question.

    Alans solution works well but the exposed property requires the user to type the name of a control from the parent form.

    If anyone reads the article and understands my problem as a result, maybe they can expand on it a little to explain how I can make the property box show a drop down list of the available qualifying controls on the Parent Form.
    I can help you with this. Will get back to you later tonight.

  4. #4

    Thread Starter
    Lively Member StoneTheCrows's Avatar
    Join Date
    Dec 2004
    Location
    UK
    Posts
    71

    Re: User Control as Property

    Dave, you have obviously picked up the fact that I posted this in Classic VB as well. Sorry I didn't pick up your replies earlier. Look forward to seeing what you have to say.
    StoneTheCrows

    _______________

    The future will be better tomorrow. (George W. Bush)

    (If you think my post was useful, please Rate it. Thanks)

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