We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Formatting and Type problem

Thread ID:





37255 Nov 17,2005 05:16 PM Nov 17,2005 06:22 PM Windows Forms 1
Tags: GridControl
Ron Pisarz
Asked On November 17, 2005 05:16 PM

I am using the Essential Studio v3.2.1.0 Grid in unbound mode. As I load data into the grid I am setting cell specific formatting and Type requirements as follows: Dim CellInfo As GridStyleInfo = Me.gridData.Item(RowIndex, ColIndex) CellInfo.Format = "#0.00%" CellInfo.CellValueType = GetType(Single) CellInfo.CellValue = .181 The grid properly displays "18.10%", the CellValue is .181, and CellValueType is Single. When the user edits the value and changes it to for example "18.40%" I receive the following exception: A first chance exception of type ''System.Exception'' occurred in system.dll Additional information: 18.4% is not a valid value for Single. If I do not set the CellValueType property to Single the user can successfully edit the cell, but the CellValueType changes from Single to String and the CellValue is the string "18.40%" not .184. Tracing the events I was able to determine this Type conversion occurs between the CurrentCellChanged event (the underlying Type was still Single during this event) and the CurrentCellEditingComplete (the underlying Type is a String during this event). The Type conversion to a String causes problems when I save data back to my objects and/or the database. The requirement is to display "18.4%" but store and persist to the database .184. Thank you for any suggestions. Ron Pisarz, Jr.

Administrator [Syncfusion]
Replied On November 17, 2005 06:22 PM

One way you can handle this is to strip out the % in CurrentCellValidating (if it is there). Here is a little sample. http://www.syncfusion.com/Support/user/uploads/GC_PC_6b91eaf5.zip


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.