|
-
Mar 8th, 2008, 08:31 AM
#1
Thread Starter
Just Married
[2.0] Create Sub Property
Hi all
How to create sub property
Code:
public class control
{
private bool first;
public bool one1
{
get
{
return _one1;
}
set
{
_one1 = value;
}
}
}
Above code creting single property and we can set this property
But can we create sub property like in this way
Code:
control.one1.visible=false
control.one1.Caption="shakti"
Because we can see this property in Label class
Code:
Label.Visible=False
Label.Caption="My Name"
Hope you got my problem
Thanks
-
Mar 8th, 2008, 08:38 AM
#2
Re: [2.0] Create Sub Property
Code:
private bool first;
public bool one1
{
get { return first; }
set { one1 = value; }
}
There an example property now whats the problem again though sorry? Sub property?
Do you mean some sort of constructor?
-
Mar 8th, 2008, 01:22 PM
#3
Re: [2.0] Create Sub Property
You can have one1 as a class of its own with those properties in it, then give control a property of type one1.
You can also perform something in the get/set block, so if your control exposes the text property, have that property set the label's text property.
-
Mar 8th, 2008, 01:48 PM
#4
Hyperactive Member
Re: [2.0] Create Sub Property
Do you mean creating a child class within a class? I'm not clear on the question, sorry.
But If create a class called control.
Then within that class, you can create a new class called one1 which has properties of .visible and .caption.
You can now reference Control.one1.visible and Control.one1.Caption.
Is that what you are looking for?
(aha upon rereading - this is what our resident three eyed frog just suggested - which just goes to prove the addage that great minds drink alike.)
"I'd rather have a full bottle in front of me than a full frontal lobotomy!"
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|