Wardeaux,
Just like any webControl. If you had coded it correctly as you drag it onto
your webform, you should get the declaration for your webcontrol in your
code behind just like with any webcontrol, use that to access its
properties.
Another way is to load it dynamically, you do this like any webcontrol
again. You declare the type first
dim mycontrol1 as mycontrol = new mycontrol
'then add the control to the page, or placeholder control
placeholder1.controls.add(mycontrol1)
'then set any properties --now it will maintain state
mycontrol1.myproperty = "Hello world"
You probably know this, however make sure you have added a reference to your
customcontrol and you see it in your references node in solution
explorer --if you added your custom control your toolbox and dragged and
dropped it onto your page then the reference is already added --otherwise
add the reference
"Wardeaux" <> wrote in message
news:%...
> I appreciate your replies, but I think you missed my question...
> I have a custom control. I want to set properties and get values from my
> custom control in my Codebehind. I place the control on my HTML page
> (MyPage.aspx). I name the control MyControl1. Now I go the codebehind
> MyPage.aspx.vb and in the PageLoad sub I want to load MyControl1 with
data,
> but when I type:
> "...
> MyControl1.MyProperty = "Hello world!"
> ..."
> I get a compile-time error stating that MyControl1 is an undeclared
> variable...
> How can I get a handle to the custom control object so that I can use it
in
> MyPage.aspx.vb?
> thanks in advance!
> wardeaux
>
> "Alessandro Zifiglio" <> wrote in
> message news:W_BNb.3605$...
> > oops, custom server control. My mistake. The example i just showed you
is
> > good. I though you were using the get/set accessors in your page and
that
> > didnt make much sense to me ;P
> > Please ignore where i said "get/set accessors are useful if you wanted
to
> > pass values to another page --plus there are some extra steps you need
to
> > take in the receiving page etc Look in the docs, its explained in
detail"
> >
> > Look at the link for more details on how to maintain state in your web
> > custom control 
> >
>
http://msdn.microsoft.com/library/de...eincontrol.asp
> >
> > "Wardeaux" <> wrote in message
> > news:...
> > > Help! I'm developing a custom server control and want to get/set
> > properties
> > > in my codebehind. I have the control set within the HTML page
correctly
> > and
> > > it loads/displays correctly, but when I try to compile my aspx.vb
code,
> it
> > > complains that my variable name is undeclared. Is there a good
article
> or
> > > sample I can use to master this? I don't need Postback, but I do want
> the
> > > properties avail during other controls postbacks. ANY assist is most
> > > appreciated!
> > > wardeaux
> > >
> > >
> >
> >
>
>