M
Mr Newbie
Hi There,
Here I am messing about with User Controls and I seem to have a conundrum on
my hands which I'm sure you chaps will unravel for me in the blink of an
eye.
When one drags a user control on to the canvas of the form designer, it
creates the HTML associated with the user control, but unlike the toolbox
controls it does not create the code for the control in the associated
forms construction code ( VB in my case ).
So in order to instantiate the control for user, I need to do this my self,
fine so far . . . .
All I want to do is to press a button on the containing form and have a
message displayed in a Literal control which is inside the User Control.
"Easy you say"
OK, bear with me . . . . . .
User controls are not loaded until after the form load event so you cannot
access them at this time and need to wait for the pre-render event right
????????
The buttons click event runs prior to the pre-render event, so how the hell
are you supposed to do this. In order to access the control at all I have to
declare a class variable of that type in the form but cant instantiate it
until the pre-render event.
I'm sure I have this all out of whack, and it's a lot simpler than I am
making it, but could someone illuminate my poor fuzzled brain on the right
approach for using User Controls in this sense. I'm sure microsoft made it
simple and My brain is trying to make it difficult.
Thank You
Mr N.......
Here I am messing about with User Controls and I seem to have a conundrum on
my hands which I'm sure you chaps will unravel for me in the blink of an
eye.
When one drags a user control on to the canvas of the form designer, it
creates the HTML associated with the user control, but unlike the toolbox
controls it does not create the code for the control in the associated
forms construction code ( VB in my case ).
So in order to instantiate the control for user, I need to do this my self,
fine so far . . . .
All I want to do is to press a button on the containing form and have a
message displayed in a Literal control which is inside the User Control.
"Easy you say"
OK, bear with me . . . . . .
User controls are not loaded until after the form load event so you cannot
access them at this time and need to wait for the pre-render event right
????????
The buttons click event runs prior to the pre-render event, so how the hell
are you supposed to do this. In order to access the control at all I have to
declare a class variable of that type in the form but cant instantiate it
until the pre-render event.
I'm sure I have this all out of whack, and it's a lot simpler than I am
making it, but could someone illuminate my poor fuzzled brain on the right
approach for using User Controls in this sense. I'm sure microsoft made it
simple and My brain is trying to make it difficult.
Thank You
Mr N.......