TEXTBOX FORMATTING in a single statement.
Textbox formating using a single line of code. I Hope this helps.
Example :
textBox1.DataBindings.Add("Text",myDataSet,"UnitCost",true,DataSourceUpdateMode.OnValidation,0,"C");
The last parameter "C" formats the UnitCost field to Currency Format. The table below is a list of string formatting parameters that you could use.
Table of Formats
--------------------------------------------------------------------------------------------------------------------------------
Type Format Example
--------------------------------------------------------------------------------------------------------------------------------
Currency C $1,234.50
Scientific
Exponential E 1.234.50E+004
Percentage P 45.6%
Fixed Decimal F? ?=no.decimals Ex. F3=123.4000
ShortDate d M/d/yyyy
LongDate D MMMM dd, yyyy
Long Date
Short Time f dddd,MMMM dd, yyyy HH:mm aa
Long Date
Long time F dddd,MMMM dd yyyy HH:mm:ss:aa
Month & Day M MMMM dd
General G Date & Time format depends on system locale settings
-------------------------------------------------------------------------------------------------------------------------------
References http://social.msdn.microsoft.com/Forums/en-US/winforms/thread/c860168f-46e5-4786-a68d-ac69c6a7a248/
Majestics
Practically a Master Poster
696 posts since Jul 2007
Reputation Points: 209
Solved Threads: 66
Skill Endorsements: 5
Check out the reference , I havent checked myself but it was accepted answer from msdn forum...
Majestics
Practically a Master Poster
696 posts since Jul 2007
Reputation Points: 209
Solved Threads: 66
Skill Endorsements: 5