Note that there are some explanatory texts on larger screens.

plurals
  1. POWPF INotifyPropertyChanged not allowing null value
    primarykey
    data
    text
    <p>Using WPF and EF and new to both. I may use the wrong terminology. </p> <p>Using the EF wizard and code generators, I set up an EF using several tables, one of which is a lookup table.</p> <p>I set up a form with a datagrid for the user to edit items in this lookup table. An issue I'm having is that the user can edit a cell, then close the form, but the editing of the cell will not update the underlying SQL database. I researched INotifyPropertyChanged and it seemed to be what I needed.</p> <p>I implemented INotifyPropertyChanged to class bound to the datagrid. Before the implementation, the datagrid displayed all null values. After implementation, a message displays when the first null value is read that a nullable object must have a value.</p> <p>Code:</p> <pre><code> Public Property ProcedureName As String Get Return _ProcedureName End Get Set(value As String) _ProcedureName = value RaisePropertyChanged("ProcedureName") End Set End Property Private _ProcedureName As String </code></pre> <p>The exception occurs at "_ProcedureName = value".</p> <p>Entire class:</p> <pre><code>Imports System </code></pre> <p>Imports System.Collections.ObjectModel</p> <p>Partial Public Class tlkpProcedures_PartB Inherits PropertyChangedBase Public Property CPT As String Get Return _CPT End Get Set(value As String) _CPT = value RaisePropertyChanged("CPT") End Set End Property Private _CPT As String Public Property ProcedureName As String Get Return _ProcedureName End Get Set(value As String) _ProcedureName = value RaisePropertyChanged("ProcedureName") End Set End Property Private _ProcedureName As String</p> <pre><code>Public Property BillingAmount As Nullable(Of Decimal) Get Return _BillingAmount End Get Set(value As Nullable(Of Decimal)) _BillingAmount = value RaisePropertyChanged("BillingAmount") End Set End Property Private _BillingAmount As Decimal Public Property UniqueID As Integer Public Overridable Property tblBilling_PartB As ObservableCollection(Of tblBilling_PartB) = New ObservableCollection(Of tblBilling_PartB) </code></pre> <p>End Class</p> <p>Any help or advice is appreciated.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload