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.
 
Back
Top