iformatprovider

Format a string to display the Date correctly.

I need help converting this string --> 20090727 10:16:36:643 to --> 07/27/2009 10:16:36 The original date and time are being returned by the SynchronizationAgent.LastUpdated() function, which returns a String in the above format. Original question:preserved for reference I have this --> HUD.LastSyncDate = mergeSubscription.Synchro...

C# IFormatable ToString("0.0000")

I have class and I want to reproduce the functionality associated with ToString("0.0000") as well as some other numerical formatting stuff. How can this be done? ...

How to create and use a custom IFormatProvider for DateTime?

Howdy! I was trying to create an IFormatProvider implementation that would recognize custom format strings for DateTime objects. Here is my implementation: public class MyDateFormatProvider : IFormatProvider, ICustomFormatter { public object GetFormat(Type formatType) { if (formatType == typeof(ICustomFormatter)) { retu...

Label.Text / Convert.ToString And String.Format Help / Thousand Separator

I have a label that i want to show it's Text("1234567") Like A Number With Thousand Separator// how can i do this with : Lable1.Text = string.Format(.....; Lable1.Text = Convet.ToString(.....; please explain these two. ...

Using a custom formatter in a DataGridView

So, maybe this is a bad design; I don't know. But say I have a DataTable with a column that holds int values; these values are in fact meant to represent some enum type that I have in my project. What I'd like to do is have a DataGridView bound to this table and have the column display the name of the enum rather than the integer value ...

C# creating a custom NumberFormatInfo to display "Free" when a currency value is $0.00

I need to display a currency in my ASP.NET MVC application but when the currency is 0 I would like it to display "Free" (localized of course!) instead of $0.00. So when I have something like this... Decimal priceFree = 0.00; Decimal priceNotFree = 100.00; priceFree.ToString("C"); priceNotFree.ToString("C"); The output is "$0.00" "$1...