Click here to Skip to main content
15,897,371 members
Home / Discussions / C#
   

C#

 
AnswerRe: Generics... Pin
DaveyM696-Nov-08 13:26
professionalDaveyM696-Nov-08 13:26 
QuestionMonitor toggle Pin
Scalee6-Nov-08 12:46
Scalee6-Nov-08 12:46 
AnswerRe: Monitor toggle Pin
Dave Kreskowiak6-Nov-08 13:20
mveDave Kreskowiak6-Nov-08 13:20 
GeneralRe: Monitor toggle Pin
Scalee6-Nov-08 21:49
Scalee6-Nov-08 21:49 
QuestionPrinting documents Pin
msx236-Nov-08 12:18
msx236-Nov-08 12:18 
AnswerRe: Printing documents Pin
DaveyM696-Nov-08 13:09
professionalDaveyM696-Nov-08 13:09 
AnswerRe: Printing documents Pin
Giorgi Dalakishvili6-Nov-08 22:23
mentorGiorgi Dalakishvili6-Nov-08 22:23 
QuestionCustom TextBox Text property default value Pin
DaveyM696-Nov-08 11:38
professionalDaveyM696-Nov-08 11:38 
I'm creating a class derived from System.Windows.Forms.TextBox. I need the Text property to have a default value of "0" and to force a repaint of another property so I've added this:
[DefaultValue("0"),
Category("Appearance"),
RefreshProperties(RefreshProperties.Repaint)]
public new string Text
{
    get { return base.Text; }
    set { base.Text = value; }
}
and added Text = "0"; in the constructor.
The problem is the default value is always "". If I set Browsable(false) then it acts as I expected. I'd like to be able to have the Text property in the property grid though.

Any ideas?

[edit] Full example code below. [/edit]
using System.ComponentModel;
using System.Windows.Forms;

public class TestTextBox : TextBox
{
    public TestTextBox()
    {
        Text = "0";
    }

    /* Removing the Browsable attribute or setting it to true
    prevents the control displaying 0 when dropped on a form. */
    [DefaultValue("0"),
    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)
Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)

AnswerRe: Custom TextBox Text property default value Pin
leppie6-Nov-08 23:01
leppie6-Nov-08 23:01 
GeneralRe: Custom TextBox Text property default value Pin
DaveyM696-Nov-08 23:23
professionalDaveyM696-Nov-08 23:23 
AnswerRe: Custom TextBox Text property default value [modified] Pin
DaveyM697-Nov-08 9:07
professionalDaveyM697-Nov-08 9:07 
QuestionProblem with downloading html from the web with httpwebrequest object Pin
Haim Nachum6-Nov-08 10:56
Haim Nachum6-Nov-08 10:56 
AnswerRe: Problem with downloading html from the web with httpwebrequest object Pin
leppie6-Nov-08 22:51
leppie6-Nov-08 22:51 
GeneralRe: Problem with downloading html from the web with httpwebrequest object Pin
Haim Nachum6-Nov-08 22:59
Haim Nachum6-Nov-08 22:59 
AnswerRe: Problem with downloading html from the web with httpwebrequest object Pin
RGiroux3211-Jan-09 16:51
RGiroux3211-Jan-09 16:51 
QuestionDiffrent behaviour Pin
bsaksida6-Nov-08 9:45
bsaksida6-Nov-08 9:45 
AnswerRe: Diffrent behaviour Pin
PIEBALDconsult6-Nov-08 10:28
mvePIEBALDconsult6-Nov-08 10:28 
GeneralRe: Diffrent behaviour Pin
Pete O'Hanlon6-Nov-08 10:45
mvePete O'Hanlon6-Nov-08 10:45 
GeneralRe: Diffrent behaviour Pin
bsaksida6-Nov-08 11:04
bsaksida6-Nov-08 11:04 
QuestionModify HtmlDocument Pin
OptiPlex6-Nov-08 8:18
OptiPlex6-Nov-08 8:18 
AnswerRe: Modify HtmlDocument Pin
Anthony Mushrow6-Nov-08 9:22
professionalAnthony Mushrow6-Nov-08 9:22 
GeneralRe: Modify HtmlDocument Pin
OptiPlex6-Nov-08 21:29
OptiPlex6-Nov-08 21:29 
QuestionCodeDom Problem,Script Application communication with Host Application? Pin
legalbattle6-Nov-08 6:46
legalbattle6-Nov-08 6:46 
AnswerRe: CodeDom Problem,Script Application communication with Host Application? [modified] Pin
Pedram Behroozi6-Nov-08 7:37
Pedram Behroozi6-Nov-08 7:37 
GeneralRe: CodeDom Problem,Script Application communication with Host Application? Pin
legalbattle6-Nov-08 14:27
legalbattle6-Nov-08 14:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.