User controls

  • Thread starter Thread starter JJ
  • Start date Start date
J

JJ

Hi all,

Can anyone tell me how I can add my own properties and methods to my custom
usercontrols?

Thanks,

Vincent
 
Vincent,

Its like adding properties and methods to any other object. All you
have to do is define them in the code for your user control. For example,
if you create a new UserControl, you can just define a property:

// In the class.
private string someValue;

public string MyProperty
{
get
{
return someValue;
}
set
{
someValue = value;
}
}

Hope this helps.
 
JJ said:
Can anyone tell me how I can add my own properties
and methods to my custom usercontrols?

Just add them to your class as public members.

public void DoSomething()
{
// ... code here ...
}

P.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top