user2005312
user2005312

Reputation: 1

Cannot create a second Dictionary Property inside the class

clsFile has 2 dictionaries, however, in constructor first dictionary is always create, but the second dictionary ends up being Nothing

Dictionaries are identical (Of Long, clsEmployee); but previously I tried making second one (of Long, clsCondition) and (Of String, clsCondoition) - to no avail. classes clsEmployee and clsCondition are also objects in the code.

Code for clsFile:

Option Explicit On
Imports System.Data.OleDb
Imports System.Data.SqlClient
Imports System.Text.RegularExpressions


Public Class clsFile


'-- CLASS LOCAL VARIABLES DECLARATION
Private cnDB As SqlConnection
Private m_Number As String
Private m_Auditor As clsEmployee
Private m_User As clsEmployee
Private m_Reviewer As clsEmployee
Private m_FileTypeId As Long
Private m_ReviewStatusId As Long
Private m_ActionDTTM As Date
Private m_SelectDTTM As Date
Private m_ReviewDTTM As Date

Private m_inAudit As Boolean
Private m_ReviewersDict As Dictionary(Of Long, clsEmployee)
Private m_ConditionsDict As Dictionary(Of Long, clsEmployee)


**************************************PROPERTIES***********************************

  Public Property Reviewers() As Dictionary(Of Long, clsEmployee)
    Get
        Reviewers = m_ReviewersDict

    End Get

    Set(ByVal ReviewersDict As Dictionary(Of Long, clsEmployee))
        m_ReviewersDict = ReviewersDict
    End Set
End Property

Public Property Conditions() As Dictionary(Of Long, clsEmployee)
    Get
        Conditions = m_ConditionsDict

    End Get

    Set(ByVal ConditionsDict As Dictionary(Of Long, clsEmployee))
        m_ConditionsDict = Conditions
    End Set
End Property

**************CONSTRUCTOR*******************

 Public Sub New(*arguments provided*)
    number= strLoanNumber

    Me.Reviewer = New clsEmployee(RVWR_ID)
    Me.Reviewer.Dept.Id = RBW_Dept_ID
    Me.Auditor = New clsEmployee(AUD_ID)
    Me.User = New clsEmployee(USR_ID)

    Me.Reviewers = New Dictionary(Of Long, clsEmployee)
    Me.Conditions = New Dictionary(Of Long, clsEmployee) 

    cnDB = SQLcn


End Sub

` when stepping through the code - Me.Conditions = nothing even after constructor has run. I use VB.net, VS2005.

Any ideas why? thanks!

Upvotes: 0

Views: 57

Answers (1)

Andrew Morton
Andrew Morton

Reputation: 25013

Surely

Set(ByVal ConditionsDict As Dictionary(Of Long, clsEmployee))
        m_ConditionsDict = Conditions
End Set

should be

Set(ByVal ConditionsDict As Dictionary(Of Long, clsEmployee))
        m_ConditionsDict = ConditionsDict
End Set

?

Upvotes: 2

Related Questions