CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2000
    Posts
    737

    active control property

    I add a property procedure into a activex control, assume it's called timeout. it appear in the property explorer in vb. I can change the value of the property. but when I run the program, the property of that activex become zero again.

    like normal label, we can set the caption to certain value and it will retains when i run a program... so why not my control ? thanks.



    HTH

    cksiow
    http://vblib.virtualave.net - share our codes

  2. #2
    Join Date
    Jan 2000
    Location
    Olen, Belgium
    Posts
    2,477

    Re: active control property

    Try these:
    1) Make sure that you also include a Get property for that.
    2) Make sure that you don't 'loose' the value in the control (like assigning it to a wrong variable, which is typically when copy/pasting)
    3) Check initialization code. If you change the value in your inisialization code of the control, you might just overwrite the given value.

    If non of them solved the problem, feel free to post some code.


    Tom Cannaerts
    [email protected]

    Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook
    Tom Cannaerts
    email: [email protected]
    www.tom.be (dutch site)

  3. #3
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    Re: active control property

    >can change the value of the property. but when I run the program, the property of that activex become zero again.

    when storing values, you should add them in property bag.
    When changing values (=property let), you should add a line: Property.Canghed thepropertyname
    Hope this solves.

    Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, TCartwright, Bruno Paris, Dr_Micahel
    and all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

    The Rater
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

  4. #4
    Join Date
    Apr 2000
    Posts
    737

    Re: active control property

    as you can see, I declare a private variable cto to store the timeout value. so, compile the control and paste it into a vb form. I change the value to 50 in the property explorer, and when i run & use debug.print to print out the connectiontimeout value, it become zero again, because cto become zero.

    see, if you add a control, e.g. label into a form, all relevant information is save into the form file. next time you bring up the form, the label will contain the data, it's true for the position data of a custom active X control, but how about saving other user define property into the form file as well, thanks.


    public property get ConnectionTimeout() as Long

    ConnectionTimeout = cto

    End property

    public property let ConnectionTimeout(byval vNewValue as Long)

    cto = vNewValue
    public property







    HTH

    cksiow
    http://vblib.virtualave.net - share our codes

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

Featured