Infralution Support Forum Index Infralution Support
Support groups for Infralution products
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Column Format causes blow-up

 
Post new topic   Reply to topic    Infralution Support Forum Index -> Virtual Tree Support
View previous topic :: View next topic  
Author Message
amsimmon



Joined: 31 Mar 2006
Posts: 13

PostPosted: Fri Mar 31, 2006 11:10 pm    Post subject: Column Format causes blow-up Reply with quote

I have a tree bound to objects. One of the fields in the object is a decimal that I want to display as currency. I went to the databinding and set the Format property on the field. If I set it ${0} it works ok, putting a dollar sign in front of the number but with the wrong number of decimal places. If I set it to ${0.00} as suggested in the documentation it blows up with this exception:

************** Exception Text **************
System.FormatException: Input string was not in a correct format.
at System.Text.StringBuilder.FormatError()
at System.Text.StringBuilder.AppendFormat(IFormatProvider provider, String format, Object[] args)
at System.String.Format(IFormatProvider provider, String format, Object[] args)
at Infralution.Controls.VirtualTree.CellData.GetText()
at Infralution.Controls.VirtualTree.CellWidget.get_Text()
at Infralution.Controls.VirtualTree.CellWidget.PaintText(Graphics graphics, Style style, Boolean printing)
at Infralution.Controls.VirtualTree.CellWidget.PaintForeground(Graphics graphics, Style style, Boolean printing)
at Infralution.Controls.VirtualTree.CellWidget.OnPaint(Graphics graphics)
at Infralution.Controls.Widget.OnPaint(Graphics graphics)
at Infralution.Controls.VirtualTree.RowWidget.OnPaint(Graphics graphics)
at Infralution.Controls.Widget.OnPaint(Graphics graphics)
at Infralution.Controls.WidgetControl.PaintWidgets(Graphics graphics, Rectangle clipRectangle)
at Infralution.Controls.WidgetControl.OnPaint(PaintEventArgs e)
at Infralution.Controls.VirtualTree.VirtualTree.OnPaint(PaintEventArgs e)
at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer, Boolean disposeEventArgs)
at System.Windows.Forms.Control.WmPaint(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at Infralution.Controls.BorderedControl.WndProc(Message& m)
at Infralution.Controls.VirtualTree.VirtualTree.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
Back to top
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Sat Apr 01, 2006 9:23 am    Post subject: Reply with quote

Try the format string: "${0:0.00}"

The first zero is a placeholder for the parameter being formatted. The part after the colon is the format for the parameter.
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
amsimmon



Joined: 31 Mar 2006
Posts: 13

PostPosted: Mon Apr 03, 2006 3:36 pm    Post subject: Reply with quote

That works, thanks!


I'm using the string below in the Format property to get the default system currency display:
{0:C}

The Virtual Tree documentation page for CellBinding.Format had the string that doesn't work.
Back to top
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Mon Apr 03, 2006 10:15 pm    Post subject: Reply with quote

Thanks you are right that's a typo in the documentation which we will fix.
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Infralution Support Forum Index -> Virtual Tree Support All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group