I have a form with two containers. One container has a checkbox, along with other stuff. I want to use the checkbox to make a second container visible or not.
The form is explicitly created in the Session.
Any ideas/help would be really appreciated!
If the container is placed on the page at design time, then the code in its events can address the other controls on the page by name. Otherwise, you should add an event to the container for the purpose of signalling the page to do something (eg., make a control visible). I try to keep the membrane between container and page solid. The container talks to the page via events, the page talks to the container by calling its methods.
Thanks guys for the tips!
What is the best practice - ie placing at design time OR embeddeding within?
Is there a speed/size penalty for one way of the other?
The event handler, should that be for the “container” or the event for the object within the container - in this case the Checkbox “ValueChanged” Event?
The event would be on the container, and raised by the event on the control.
Must be a mind block…
In cntMsg which is instantiated in the Open Event of the MsgPage, I have:
In the CheckBox ValueChanged Event "RaiseEvent MakVisible(Me.Value)
The container cntMsg I added an Event Definition “MakVisible(Vis As Boolean)”
I tried to add an Event Handler in the MsgPage object, but no way (seemingly) to do it. Right click on MsgPage then “add to MsgPage” Event Handler - no option shown for “MakVisible”.
Where have I gone wrong? I am sure this is simple - but so frustrating that something is missing…
Please advise -
If you instantiate it in code (via EmbedWithin), use AddHandler to tie the event to a method.