R
Ryan0827
Guest
ERROR: System.Data.StrongTypingException: 'The value for column 'EstimatedValue' in table 'vProject' is DBNull.'
I'm trying to bind the Text property of a TextBox to a Decimal field in my strongly typed dataset.
Me.MyTextBox.DataBindings.Add("Text", MyDataRow, MyDataRow.Table.DecimalColumn.ColumnName, False, DataSourceUpdateMode.OnPropertyChanged)
Binding Parse & Format events never fire. I think because the Binding class is calling the DecimalColumn property of the typed DataRow that explicitly throws an exception if a null exists.
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "15.0.0.0")> _
Public Property DecimalColumn() As Decimal
Get
Try
Return CType(Me(Me.Table.DeciamlColumn),Decimal)
Catch e As Global.System.InvalidCastException
Throw New Global.System.Data.StrongTypingException("The value for column 'DeciamlColumn' in table 'Table' is DBNull.", e)
End Try
End Get
Set
Me(Me.Table.DeciamlColumn) = value
End Set
End Property
I can't change the NullValue from "(Throw exception)" in the datasets properties window.

How do I bind a textbox to a decimal column or a DateTimePicker to a date column when the columns allow nulls?
Ryan
Continue reading...
I'm trying to bind the Text property of a TextBox to a Decimal field in my strongly typed dataset.
Me.MyTextBox.DataBindings.Add("Text", MyDataRow, MyDataRow.Table.DecimalColumn.ColumnName, False, DataSourceUpdateMode.OnPropertyChanged)
Binding Parse & Format events never fire. I think because the Binding class is calling the DecimalColumn property of the typed DataRow that explicitly throws an exception if a null exists.
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "15.0.0.0")> _
Public Property DecimalColumn() As Decimal
Get
Try
Return CType(Me(Me.Table.DeciamlColumn),Decimal)
Catch e As Global.System.InvalidCastException
Throw New Global.System.Data.StrongTypingException("The value for column 'DeciamlColumn' in table 'Table' is DBNull.", e)
End Try
End Get
Set
Me(Me.Table.DeciamlColumn) = value
End Set
End Property
I can't change the NullValue from "(Throw exception)" in the datasets properties window.

How do I bind a textbox to a decimal column or a DateTimePicker to a date column when the columns allow nulls?
Ryan
Continue reading...