johnfraser
Programmer
I'm attempting to override a textbox control .Text property with the simple "AddCommasToNumber" when you call the Text Set property.
The catch is that I want the Text Get to return just the number.
Well apparently to display the text it must call it's own "Text Get Property" because if I have it setup as below, the commas don't show on the form:
So really want I'm looking for is to create a control that will display values with commas but setting and getting the values from the control itself is plain and simple.
Seems easy enough, apparently I'm missing something vital (or stupid) here.
The catch is that I want the Text Get to return just the number.
Code:
control.Text = "1000";
//Displays "1,000";
string myString = control.Text;
//myString = 1000;
Well apparently to display the text it must call it's own "Text Get Property" because if I have it setup as below, the commas don't show on the form:
Code:
public override string Text
{
get
{
//return text;
return RemoveComma(text);
}
set
{
string dec = StoreDecimal(value, out value);
value = AddComma(value);
value = RestoreDecimal(value, dec);
text = value;
}
}
So really want I'm looking for is to create a control that will display values with commas but setting and getting the values from the control itself is plain and simple.
Seems easy enough, apparently I'm missing something vital (or stupid) here.