Re: Type convertsion from string



Marc,

Thank you.

If I enter characters to numeric column I get exception "eee is not a valid
value for Decimal." at line

object val = p.Converter.ConvertFromString(ctx, propertyValue);
How to fix ?

Why CanConvertFrom() returns true ?

I want to allow users to add calculated columns to table at runtime.
Is it possible to add new calculated property to object at runtime or is
there any other solution ?

Andrus.

Exception which I got:

System.Exception was unhandled
Message="eee is not a valid value for Decimal."
Source="System"
StackTrace:
at
System.ComponentModel.BaseNumberConverter.ConvertFrom(ITypeDescriptorContext
context, CultureInfo culture, Object value)
at
System.ComponentModel.TypeConverter.ConvertFromString(ITypeDescriptorContext
context, String text)
at My.Business.StringConverter.SetValue(Object obj, String
propertyName, String propertyValue)
at
My.Windows.Forms.VirtualGrid`1.OnCellValuePushed(DataGridViewCellValueEventArgs
e)
at System.Windows.Forms.DataGridView.OnCellValuePushed(Int32
columnIndex, Int32 rowIndex, Object value)
at System.Windows.Forms.DataGridViewCell.SetValue(Int32 rowIndex,
Object value)
at
System.Windows.Forms.DataGridView.PushFormattedValue(DataGridViewCell&
dataGridViewCurrentCell, Object formattedValue, Exception& exception)
at System.Windows.Forms.DataGridView.CommitEdit(DataGridViewCell&
dataGridViewCurrentCell, DataGridViewDataErrorContexts context,
DataGridViewValidateCellInternal validateCell, Boolean fireCellLeave,
Boolean fireCellEnter, Boolean fireRowLeave, Boolean fireRowEnter, Boolean
fireLeave)
at
System.Windows.Forms.DataGridView.EndEdit(DataGridViewDataErrorContexts
context, DataGridViewValidateCellInternal validateCell, Boolean
fireCellLeave, Boolean fireCellEnter, Boolean fireRowLeave, Boolean
fireRowEnter, Boolean fireLeave, Boolean keepFocus, Boolean
resetCurrentCell, Boolean resetAnchorCell)
at System.Windows.Forms.DataGridView.CommitEditForOperation(Int32
columnIndex, Int32 rowIndex, Boolean forCurrentCellChange)
at System.Windows.Forms.DataGridView.ScrollIntoView(Int32
columnIndex, Int32 rowIndex, Boolean forCurrentCellChange)
at System.Windows.Forms.DataGridView.TabToNextCell()
at System.Windows.Forms.DataGridView.ProcessTabKey(Keys keyData)
at System.Windows.Forms.DataGridView.ProcessDialogKey(Keys keyData)
at System.Windows.Forms.Control.ProcessDialogKey(Keys keyData)
at System.Windows.Forms.TextBoxBase.ProcessDialogKey(Keys keyData)
at System.Windows.Forms.Control.PreProcessMessage(Message& msg)
....



.



Relevant Pages

  • OutOfMemoryException when using a datagridview in a panel
    ... I am using .NET 2.0 and a datagridview in panel. ... DataGridViewValidateCellInternal validateCell, Boolean fireCellLeave, ... columnIndex, Int32 rowIndex, Boolean setAnchorCellAddress, Boolean ...
    (microsoft.public.dotnet.framework.windowsforms)
  • Re: JTable and input methods (or, and: focus in JTextField)
    ... public void changeSelection(int rowIndex, int columnIndex, boolean ... as soon as the other clicks on a cell or tabs to a cell ... when the user types the first character ...
    (comp.lang.java.gui)
  • Unable to Write to Event Log w/ Enterprise Library 2.0 in Win App
    ... ExceptionPolicy.HandleException(ex, "Sample Exception Policy") ... keys, SectionInput input, Boolean isTrusted, FactoryRecord factoryRecord, ... configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, ... context, String name, IConfigurationSource configurationSource, ...
    (microsoft.public.dotnet.general)
  • Re: urgent: beta 2.0 error
    ... Microsoft Online Support ... An unhandled exception has occurred. ... |> | Request URL: ... Boolean& ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Sharepoint 2007 - Installation Error - Failed to register SP servi
    ... The issue stems from the installer going to a remote computer for SQL Server. ... Server I have the following exception: ... exception, Boolean breakConnection) ... RunBehavior runBehavior, String resetOptionsString) ...
    (microsoft.public.sharepoint.portalserver)