how to hide a particular property of a control which is on windows forms
-
Hi All, I stuck in a problem please help me :(( , My problem is that I have a windowsForm at this 4 buttons are there. I want to hide the "Text" property of one particular button from Property window so that no one can assign value to it from property window but at the same time he can be able to assing "Text" property programitically :confused:. e.g. : button1.Text = "Register"; it will be possible by programatically not from property windows :( . thanx in advance... :rose:
-
Hi All, I stuck in a problem please help me :(( , My problem is that I have a windowsForm at this 4 buttons are there. I want to hide the "Text" property of one particular button from Property window so that no one can assign value to it from property window but at the same time he can be able to assing "Text" property programitically :confused:. e.g. : button1.Text = "Register"; it will be possible by programatically not from property windows :( . thanx in advance... :rose:
I believe you have to create your own class that derives from Button like this.
using System.ComponentModel;
using System.Windows.Forms;public class MyButton : Button
{
[Browsable(false)]
public new string Text
{
get { return base.Text; }
set { base.Text = value; }
}
}Dave
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
Expect everything to be hard and then enjoy the things that come easy. (code-frog) -
I believe you have to create your own class that derives from Button like this.
using System.ComponentModel;
using System.Windows.Forms;public class MyButton : Button
{
[Browsable(false)]
public new string Text
{
get { return base.Text; }
set { base.Text = value; }
}
}Dave
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
Expect everything to be hard and then enjoy the things that come easy. (code-frog)Hi, I think You didn't understand my Question. I want to hide the particular property of existing control without inheriting on my form ( in current suitation it is button but in another case it may be another control or may be more than one controls ). I do not want to inherit all control and then I hide that particular property by overriding. I only want that I stick a perticular control on my form and hide some properties of it. for example : At my form there are 4 controls 1. button : I want to hide the 'Text' Property of this, from property windows sothat developer can not set it's Text from property window 2. textbox : I want to hide the 'Size' Property of this control from property windows only 3. gridview : I want to hide the 'Name' Property of this control from property windows only 4. Groupbox : I want to hide the ' Location' Property of this control from property windows only And all of cases I do not want to inherit any control.
-
Hi, I think You didn't understand my Question. I want to hide the particular property of existing control without inheriting on my form ( in current suitation it is button but in another case it may be another control or may be more than one controls ). I do not want to inherit all control and then I hide that particular property by overriding. I only want that I stick a perticular control on my form and hide some properties of it. for example : At my form there are 4 controls 1. button : I want to hide the 'Text' Property of this, from property windows sothat developer can not set it's Text from property window 2. textbox : I want to hide the 'Size' Property of this control from property windows only 3. gridview : I want to hide the 'Name' Property of this control from property windows only 4. Groupbox : I want to hide the ' Location' Property of this control from property windows only And all of cases I do not want to inherit any control.
What you want isn't possible as the properties and attributes have been set by MS in the source. The only way is use your own controls where you get to set these yourself.
Dave
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
Expect everything to be hard and then enjoy the things that come easy. (code-frog) -
Hi All, I stuck in a problem please help me :(( , My problem is that I have a windowsForm at this 4 buttons are there. I want to hide the "Text" property of one particular button from Property window so that no one can assign value to it from property window but at the same time he can be able to assing "Text" property programitically :confused:. e.g. : button1.Text = "Register"; it will be possible by programatically not from property windows :( . thanx in advance... :rose:
i think what you want is only possible if we have the visual studio code.