473,657 Members | 2,423 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Add/remove propeties of user controls

1 New Member
Dear All,

I am making a Windows Control Library(user control) using VS.NET & C#.NET. Now, i am facing 3 problems:

1.In this control, i wants to remove some of the properties which are available by default to the controls. These properties must be removed from the 'Properties window' of the usercontrol. Also the user must not be able to set these properties using code.
I am able to remove the properties from the 'Properties window' by inheriting a class from the System.Windows. Forms.Design.Sc rollableControl Designer & removing the properties by overriding the PreFilterProper ties function as show below:
protected override void PreFilterProper ties(System.Col lections.IDicti onary

properties)
{
properties.Remo ve("BackColor") ;
}
But, doing so, this property is available to be set from the code. How can i remove this property fully?

2.I wants to create a property for the control which has sub properties, like the
'Location' property of a button, which has sub properties as 'X, Y & Locked'.
My new property for the control must have some subproperties like this. How can i achieve this?

3.I wants to add a property to the user control which allows the user to select a color.
When the user selects this property, it must display the color pallete for selecting the color for the satndard properties like 'BackColor'. Then the user must be able to select the required color from these options & the value must be stored in that specific property.

Kindly help me to acheieve the above scenarios

Best Regards,
Abhilash Chandran
Jun 14 '07 #1
1 1538
kenobewan
4,871 Recognized Expert Specialist
Removing a property does not remove it from the framework. Sounds like you need two custom controls to solve your other problems. HTH.
Jun 14 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

7
1437
by: Greg | last post by:
I have a base class for a label. I want to set a property at the base class level, say AutoSize = true. Then at the form level I want to be able to overide the base class setting so that I can turn it off when needed. What is happening is that at the form level, I can set the autosize to false, but then when I recompile, the autosize is set back to true. This is what the base class looks like: public class LabelBase : Label
9
15334
by: Merlin | last post by:
Hi, My code below doesn't work does anyone have any pointers? All my controls are programically added. Dim i As Int16 For i = 0 To Me.Controls.Count - 1 If Me.Controls(i).Name <> "TheOneIWantToKeep" Then Me.Controls.RemoveAt(i) End If
9
20158
by: Charles Law | last post by:
I have a form on which user controls are placed at runtime. When a control is added to the form a handler is added for an event that a high-level object raises, which must be handled by the new control. When I close the form I am expecting that the control ceases to be. However, if my object raises the event after the form has been closed, I find that there is still a user control object that handles it. Clearly the user control has not...
3
2620
by: Zorpiedoman | last post by:
Horay! I have just put the finishing touches on a new User Control... The" Jelly Button" I created a setup program which runs fine. I see the .dll nicely in the GAC. How come it does not show up in my Add/Remove componenets list when I try to add it to the toolbar?
0
1033
by: Yourself | last post by:
I have the following .aspx code: <%@ Page Language="vb" AutoEventWireup="false" Explicit="True" Inherits="Whatever.DefaultPage" CodeFile="Default.aspx.vb" %> <%@ Register TagPrefix="whatever" TagName="something" Src="~/Whatever/Whatever.ascx" %> <asp:placeholder id="fred" runat="server"></asp:placeholder> <whatever:something id="something" runat="server" /> the Default.aspx.vb code adds some controls to the 'fred' placeholder in the
5
3979
by: Mike TI | last post by:
March 24, 2006 Hi all I am new to VB.NET and am using VB.NET 2005. I have an MDI form with a Split Container Control. On demand I am adding and removing User Controls on Panel 2. I am using Show() and Hide(). It works perfectly. The only thing is I would like to remove the User Control from memory instead of hiding. I tried Dispose(), however then I cannot show this
8
3730
by: hunanwarrior | last post by:
I added textbox controls to a form when user selects amount to create from a combobox as follows: 'Load up the combobox Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim i As Integer For i = 1 To 10 cbxItemCnt.Items.Add(i) Next
1
3116
by: maflatoun | last post by:
Hi, I have a user control that I add dynamically. Once certain action is performed I want to remove it completely. My questions are 1. How do you check to see if a user control already exists or not? 2. How do you remove it after it's been added? I added by doing the following
2
9078
by: =?Utf-8?B?R3JlZw==?= | last post by:
I have the following code the dynamically adds a specific number of controls. for x as integer = 1 to 10 Dim btn as Windows.Forms.Button = New Windows.Forms.Button btn.Name = "btn" & x btn.Text = "Test" & x controls.add(btn) next x This results in 10 buttons appearing on the screen. I've excluded the
0
8394
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8306
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8825
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8732
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8605
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4152
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1615
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.