My question is how to create this: for an existing object a new custom property?
"existing object"= an object control in general (ex: a textbox)
"new custom property"= by default this control "textbox" have this property:
...and many other properties off course,but I snipe to this particular one, only.
In what way? Well, I want that a single button to have a custom property write by me, named "myHideShowProperty" that can do 2 things in one package, I mean that when I click once, "Show" that textbox ; and when I click one more time it "Hide" that textbox, then when I click once more it "Show" a textbox,and so on.
In the end, the code I imagine that it must look like this:
The idea behind all of this is how to write a customized property for an existing object control.
And of course a solution for my problem, if there is one.
though I must mention that I have made a variant and it works:
"existing object"= an object control in general (ex: a textbox)
"new custom property"= by default this control "textbox" have this property:
Code:
textbox.Hide();
In what way? Well, I want that a single button to have a custom property write by me, named "myHideShowProperty" that can do 2 things in one package, I mean that when I click once, "Show" that textbox ; and when I click one more time it "Hide" that textbox, then when I click once more it "Show" a textbox,and so on.
In the end, the code I imagine that it must look like this:
Code:
//im sure this is ilogical but this is how I imagine this thing could be:
btn1.myHideShowProperty.show(textbox);
btn1.myHideShowProperty.hide(textbox);
The idea behind all of this is how to write a customized property for an existing object control.
And of course a solution for my problem, if there is one.
though I must mention that I have made a variant and it works:
Code:
// two buttons on top of each other
private void button1_Click(object sender, EventArgs e)
{
button1.Hide();
button3.Show();
button3.Text = "second btn";
}
private void button3_Click(object sender, EventArgs e)
{
button3.Hide();
button1.Show();
button1.Text = "first btn";
}
//but is a silly code,no? :)