Article View: borland.public.csharpbuilder.language.csharp
Article #403Re: FormatText
From: David Clegg
Date: Tue, 20 Sep 2005 01:44
Date: Tue, 20 Sep 2005 01:44
29 lines
1785 bytes
1785 bytes
Jeff wrote:
> aValue = TextBox3.Text;
> TextBox3.Text = System.String.Format("{0:C2}", aValue);
You need to convert TextBox3.Text to a decimal first. Try the following
:-
try {
decimal aValue = Decimal.Parse(TextBox3.Text);
TextBox3.Text = System.String.Format("{0:C2}", aValue);
}
catch (FormatException) {
//Do something with FormatException
}
--
Cheers,
David Clegg
dclegg@gmail.com
Vote 1 http://cc.borland.com/codecentral/ccweb.exe/listing?id=21489 :-)
Now supports Google Groups searching with Dyna-extend(tm) technology!
QualityCentral. The best way to bug Borland about bugs.
http://qc.borland.com
"Facts are meaningless. You could use facts to prove anything that's
even remotely true." - Homer Simpson
Technical Details
Message-ID:
<xn0e7gxqh1rc847009@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<432f6234$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 1efe35,95e04c7c9049104a
X-Google-Attributes: gid1efe35,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "David Clegg" <dclegg@gmail.com>
Subject: Re: FormatText
Newsgroups: borland.public.csharpbuilder.language.csharp
References: <432f6234$1@newsgroups.borland.com>
Organization: eBet Limited
User-Agent: XanaNews/1.17.6.2
X-Face: d0!4zUWIBj<CO5m0`=Vu"m.2)(~|1-4:I]5n5<OE<hv+kK)Z:n<h&MnW9t_{}>cw&gbV#f>mHS4h1mcw[cz:R#J,T;)w/($:2Vl5CQnFP(c\wmN0rSvn25.kmVpCmqb]gj7l9ZP+O4+a+P~L#]4s""Tx^zQ/N"#'/?lV?SHpdR\5(iNj.,I_YMfF=/_3.JWAs3
Message-ID: <xn0e7gxqh1rc847009@newsgroups.borland.com>
X-Ref: newsgroups.borland.com ~XNS:00000D95
NNTP-Posting-Host: 210.55.248.220
Date: 19 Sep 2005 18:44:16 -0700
X-Trace: newsgroups.borland.com 1127180656 210.55.248.220 (19 Sep 2005 18:44:16 -0700)
Lines: 29
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail