Click to See Complete Forum and Search --> : active control property


cksiow
October 1st, 2001, 09:41 PM
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

Cakkie
October 2nd, 2001, 01:41 AM
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
slisse@planetinternet.be

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

Cimperiali
October 2nd, 2001, 01:44 AM
>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

cksiow
October 2nd, 2001, 11:41 PM
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