|
-
Mar 30th, 2009, 09:26 PM
#1
Thread Starter
Hyperactive Member
user control problem
hi all,
i created a user control and inherited a textbox.
is it possible to remove some of the inherited properties of the user control?
like to Multi-Line, PasswordChar etc... also at the Form Design, when selecting the user control, there's an arrow on the upper-right which i also want to remove. how can i do this?
thanks
VB Version: Microsoft Visual Studio 2008 Professional Edition
.NET Version: Microsoft .NET Framework Version 3.5
OS: Windows XP SP3
-
Mar 30th, 2009, 10:01 PM
#2
Re: user control problem
First up, a user control is a class that inherits UserControl. If you inherited TextBox then it's more correctly a custom control.
As for the first question, you can't actually remove an inherited member. All you can do is hide the member from the IDE. The following code creates a custom TextBox control that will not display its Multiline property in either the design window or the Intellisense lists in the code window:
vb.net Code:
Imports System.ComponentModel Public Class TextBoxEx Inherits TextBox <EditorBrowsable(EditorBrowsableState.Never), Browsable(False)> _ Public Shadows Property Multiline() As Boolean Get Return MyBase.Multiline End Get Set(ByVal value As Boolean) MyBase.Multiline = value End Set End Property End Class
The member still exists, so it can still be accessed in code. you just won't get any help from the IDE to do so.
As for the last question, that is called a smart tag and is created using XML. I don't how you'd remove it, or even if you can, but if you were to read up about how they're created in the first place then that might lead you to a way to remove it in a derived class.
-
Mar 31st, 2009, 02:50 AM
#3
Thread Starter
Hyperactive Member
Re: user control problem
thanks...
this is able to hide the property at design time...
i did try a few search regarding the smart tag and came across a thread that suggested i should override the PostFilterProperties.
Code:
Protected Overridable Sub PostFilterProperties(ByVal properties As IDictionary)
With properties
.Remove("Multiline")
End With
End Sub
can't get it to work yet... still digging.
VB Version: Microsoft Visual Studio 2008 Professional Edition
.NET Version: Microsoft .NET Framework Version 3.5
OS: Windows XP SP3
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
|