I went to the FAqs and I can't find an answer.
I have set up a clear function and I can't get it to work.
I am hoping someone can help!
I have set up a four teir project:
This is in my business layer and is called EmployeeBL
Private Sub SetMachineState(ByVal newState As StateMachine.MachineState)
'auto load to read, later will be real to db
If newState = MachineState.Load Then
m_stcCurrentData = m_objEmployeeDA.SelectData
newState = MachineState.Read
End If
'change state data
m_enuMachineState = newState
'Clear broken rule
m_colBrokenRules.Clear()
'raise event
RaiseEvent MachineStateChanged(Me, New EventArgs())
End Sub
Private Sub SetIsValid(ByVal IsValid As Boolean)
If Me.IsValid <> IsValid Then
m_bolIsValid = IsValid
RaiseEvent IsValidChanged(Me, New EventArgs())
End If
End Sub
This is in my business layer
This is called NorthwindBL.Broken Rules
Public Class BrokenRules
Inherits DictionaryBase
Public ReadOnly Property IsValid() As Boolean
Get
Return (Me.Count = 0) 'if the count is 0, the object is valid
End Get
End Property
This is on my form level
#Region "Form Validity Check"
Private Sub m_objEmployeeBL_IsValidChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles m_objEmployeeBL.IsValidChanged
'This subroutine defines the current state of the valid property
If m_objEmployeeBL.IsValid Then
stpIsValid.Text = "Is Valid"
Else
stpIsValid.Text = "Is not Valid"
End If
End Sub
#End Region
This is in my form level
Private Sub EmployeesForm_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
'initComboboxes
PopControls()
BindControlsToData()
'init State Machine
SetMachineStateControls(m_objEmployeeBL.MachineState)
'Set IsDirty and IsValid states at form load
m_objEmployeeBL_IsDirtyChanged(Me, New EventArgs())
m_objEmployeeBL_IsValidChanged(Me, New EventArgs())
End Sub
I think this is the right code.
The error message I am getting states:
An unhandled exception of type System.typeload exception
Additional information:
Declaration referenced in a method implementation can not be a final method
Type:NorthwindBL.brokenrules.
assembly clear
I have set up a clear function and I can't get it to work.
I am hoping someone can help!
I have set up a four teir project:
This is in my business layer and is called EmployeeBL
Private Sub SetMachineState(ByVal newState As StateMachine.MachineState)
'auto load to read, later will be real to db
If newState = MachineState.Load Then
m_stcCurrentData = m_objEmployeeDA.SelectData
newState = MachineState.Read
End If
'change state data
m_enuMachineState = newState
'Clear broken rule
m_colBrokenRules.Clear()
'raise event
RaiseEvent MachineStateChanged(Me, New EventArgs())
End Sub
Private Sub SetIsValid(ByVal IsValid As Boolean)
If Me.IsValid <> IsValid Then
m_bolIsValid = IsValid
RaiseEvent IsValidChanged(Me, New EventArgs())
End If
End Sub
This is in my business layer
This is called NorthwindBL.Broken Rules
Public Class BrokenRules
Inherits DictionaryBase
Public ReadOnly Property IsValid() As Boolean
Get
Return (Me.Count = 0) 'if the count is 0, the object is valid
End Get
End Property
This is on my form level
#Region "Form Validity Check"
Private Sub m_objEmployeeBL_IsValidChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles m_objEmployeeBL.IsValidChanged
'This subroutine defines the current state of the valid property
If m_objEmployeeBL.IsValid Then
stpIsValid.Text = "Is Valid"
Else
stpIsValid.Text = "Is not Valid"
End If
End Sub
#End Region
This is in my form level
Private Sub EmployeesForm_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
'initComboboxes
PopControls()
BindControlsToData()
'init State Machine
SetMachineStateControls(m_objEmployeeBL.MachineState)
'Set IsDirty and IsValid states at form load
m_objEmployeeBL_IsDirtyChanged(Me, New EventArgs())
m_objEmployeeBL_IsValidChanged(Me, New EventArgs())
End Sub
I think this is the right code.
The error message I am getting states:
An unhandled exception of type System.typeload exception
Additional information:
Declaration referenced in a method implementation can not be a final method
Type:NorthwindBL.brokenrules.
assembly clear