Is it possible to cast something to an iFormatProvider?
I have a date that is going to dynamically change formatting; so I need to pass it a variable format.
Is it possible to pass a format to a control as a property and apply that format to an item under the control?
Example of how the format is being used in my control
CODE
Me.cvMaxDate.ValueToCompare = value.ToString(Format)
If I pass the Format mask to the control as an String, it won't allow me to use it in the ToString, and if I try to cast it to an iformatprovider, I get a cast exception.
I tried making the format property of data type iformatprovider; however when I pass the date format to the control with
CODE
Format="MM/dd/yyyy"
I get "Cannot create an object of type 'System.IFormatProvider' from its string representation 'MM/dd/yyyy' for the 'Format' property."
I just can't seem to get that dynamic format to work whatever I do!
Any help would be greatly appreciated!