473,804 Members | 3,572 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

User control Text property not appearing in Properties window

Greetings!

I just developed a little control I've wanted for ages. It links a textbox
and a label into a single control. At first, I gave it a property named
LabelText and another named BoxText. Both of them happily appeared in the
Properties window when I dropped my control onto another control. But then
I remembered that Microsoft wants to standardize on using the property name
"Text" for things that look like text. I decided that the text box's text
was the important thing in the control, so I changed the name of BoxText to
Text. But now the Text property does not appear in the Properties window!
What do I have to do to get it to show up? I think it's related to the fact
that the UserControl class has a Text property already.

Here's the definition of the Text property:

public new string Text
{
get
{
return theTextBox.Text ;
}
set
{
theTextBox.Text = value;
}
}

I tried using "override" instead of "new", but that didn't work either.

Thanks very much!

RobR
Nov 16 '05 #1
2 13189
Why not just override the parents' Text property? Maybe it is having
problems with two Text properties. Just a guess though.

"Rob Richardson" <no*******@n2ne t.net> wrote in message
news:#K******** ******@TK2MSFTN GP14.phx.gbl...
Greetings!

I just developed a little control I've wanted for ages. It links a textbox and a label into a single control. At first, I gave it a property named
LabelText and another named BoxText. Both of them happily appeared in the
Properties window when I dropped my control onto another control. But then I remembered that Microsoft wants to standardize on using the property name "Text" for things that look like text. I decided that the text box's text
was the important thing in the control, so I changed the name of BoxText to Text. But now the Text property does not appear in the Properties window!
What do I have to do to get it to show up? I think it's related to the fact that the UserControl class has a Text property already.

Here's the definition of the Text property:

public new string Text
{
get
{
return theTextBox.Text ;
}
set
{
theTextBox.Text = value;
}
}

I tried using "override" instead of "new", but that didn't work either.

Thanks very much!

RobR

Nov 16 '05 #2
Use a declaration like this.

[EditorBrowsable (EditorBrowsabl eState.Always), Browsable(true) ,
DesignerSeriali zationVisibilit y(DesignerSeria lizationVisibil ity.Visible),
Bindable(true)]
public override string Text {get; set;}

The UserControl is overriding the Control.Text property and adding
attributes to hide it from the properties window, editor, etc. These
attributes are being inherited and thus you are not seeing the property
appear.

--
Tim Wilson
..Net Compact Framework MVP

"Rob Richardson" <no*******@n2ne t.net> wrote in message
news:%2******** ********@TK2MSF TNGP14.phx.gbl. ..
Greetings!

I just developed a little control I've wanted for ages. It links a textbox and a label into a single control. At first, I gave it a property named
LabelText and another named BoxText. Both of them happily appeared in the
Properties window when I dropped my control onto another control. But then I remembered that Microsoft wants to standardize on using the property name "Text" for things that look like text. I decided that the text box's text
was the important thing in the control, so I changed the name of BoxText to Text. But now the Text property does not appear in the Properties window!
What do I have to do to get it to show up? I think it's related to the fact that the UserControl class has a Text property already.

Here's the definition of the Text property:

public new string Text
{
get
{
return theTextBox.Text ;
}
set
{
theTextBox.Text = value;
}
}

I tried using "override" instead of "new", but that didn't work either.

Thanks very much!

RobR

Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
3707
by: Doug | last post by:
I'm trying to create a user control that would have a ListDictionary property. When trying to use the property and set values for this collection, the dialog box that appears has everything disabled. I'm unsure of what I have to have set in code in order to enable this??
0
622
by: Colin | last post by:
Hi there, I really need your help on this. I'm trying to learn to using the VS.2003 to create a User Control. In my aspx code has no problem to use the property "grossWaye" that has "register" in the aspx code if I don't use "Codebehind" directive. If I try to move the <script></script> coding the Codebehind of the VS2003. I don't know how to get the property "grossWaye". I post both User Control and .aspx codes for your help. Thanks in...
1
11097
by: Steven.Xu | last post by:
Hi, everyone. I am writting an user control. There has some properties on it. At the design time, the properties will disply on the property windows and user could change it's value after selected the property item. My problem is when someone select the property item on the property window. There has no description about the user control property at the bottom of property window. It just show the property name on it. I think it must...
0
1153
by: PhilC | last post by:
I'm not sure what I'm doing wrong here... I've created a web parts zone, and a catalog zone. Now if I create a very simple user control called "Tester": public partial class Tester : System.Web.UI.UserControl { public string Caption { get { return (string)ViewState; }
2
2069
by: Mark | last post by:
Hi. I am making a user control right now, and it looks something like this: <script runat="server"> public string SelectCommand { set { // see below for why the following line is here.
2
1968
by: jamesd | last post by:
I have a user control that has some simple textboxes. The user control is placed into a regular webform with a submit button on it. When the submit button is clicked, the form is posted to the server. The user control contains some code to SERVER SIDE validate one of the textboxes. IF the validation fails, i want the parent web form to know about it, and display a message on the screen.
0
960
by: Faitec | last post by:
Hi guys and gals! I'm writting a simple user control and I need to conditionally set the size of it at control load time. I have coded that into the constructor. It runs but the changes are not displayed on the screen (on the form at run time). At this time the parent property of the control is null. At what point (ie is there a handy event) are the properties BOTH standard and my custom ones all loaded up? I need access to the design...
0
1255
by: sudhashekhar30 | last post by:
hi i m trying to set text property of label which is in content page from javascript function. function empcodesize() { var size=document.getElementById('<%=TxtempCode.ClientID %>').value; var lblmsg=document.getElementById('<%=LblValidMsg.ClientID %>').id; var len=size.length; if(len<9) { set text property of label here or any other option }
0
867
by: daokfella | last post by:
I have a custom server control that needs to have a TargetControl property. I'd like the properties window to display a dropdownlist of all page controls (similar to how a validation control shows controls that can be validated). How is this accomplished?
0
9704
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
9569
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,...
1
10302
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10069
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
9130
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6844
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
5636
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3802
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2975
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.