Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. how to hide a particular property of a control which is on windows forms

how to hide a particular property of a control which is on windows forms

Scheduled Pinned Locked Moved C#
helpwinformstutorial
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    Guru Call
    wrote on last edited by
    #1

    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:

    D N 2 Replies Last reply
    0
    • G Guru Call

      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:

      D Offline
      D Offline
      DaveyM69
      wrote on last edited by
      #2

      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)

      G 1 Reply Last reply
      0
      • D DaveyM69

        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)

        G Offline
        G Offline
        Guru Call
        wrote on last edited by
        #3

        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.

        D 1 Reply Last reply
        0
        • G Guru Call

          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.

          D Offline
          D Offline
          DaveyM69
          wrote on last edited by
          #4

          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)

          1 Reply Last reply
          0
          • G Guru Call

            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:

            N Offline
            N Offline
            Nouman Bhatti
            wrote on last edited by
            #5

            i think what you want is only possible if we have the visual studio code.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups