Hi All,

We have a module in VB that creates a tree object. The tree worked fine with the original project/solution, but when converting to 2005 the SharedModule.vb, which is below, now receives a warning of Type of parameter '[pameterName]' is not CLS-Compliant

I have placed bold tags around the 3 parameters in question, but has anyone run into this problem, and can please help me with the resolution.

The new tree just lists every node as text, where you could expand and collapse the old tree, which also would activate other events.

Thanks and have a Groovey Day!!

Imports Microsoft.Web.UI.WebControls
Imports SafetyKleen.Components

Namespace SafetyKleen.Web.WasteApprovalWizard

Public Module SharedModule
    Public Const SESSION_TIMEOUT_ERROR_MESSAGE As String = "Your session has timed out.  Please login again."
    Public Const DROP_DOWN_NO_SELECTION As String = "_noselection_"
    Public Const DROP_DOWN_NO_SELECTION_TEXT As String = "{please select value}"
    Public Const DROP_DOWN_SPLIT_CHAR As String = "/"

    ' PGW NodeData constants
    Public Enum PGWNodeDataFields
        NEXT_PRCS_ID = 0
        CSTT_SLCT_FLG = 1
        FORM_TYPE_INDX_CD = 2
        CONT_FLG = 3
        CTRL_NUM = 4
    End Enum

    ' METHOD:           PopulatePGWTree
    ' DESCRIPTION:      
    '   parentNode      - Parent node (for root level items this should be 'Nothing')
    '   processTypeId   - 
    '   countryCode     - Country code to be used when selecting PGW items from DB
    '   processTypeId   - 
    '   treeView        - Reference to the UI TreeView control being populated
    Public Sub PopulatePGWTree(ByVal parentNode As TreeNode, ByVal processTypeId As Integer, _
                        ByVal pgwDataTable As DataTable, ByVal treeView As TreeView)
        Dim ProcessGeneratingWaste As ProcessGeneratingWaste = New ProcessGeneratingWaste()
        Dim processId As Integer
        Dim SelectedRows As DataRow()

        Const PGW_ROOT_PROCESS_ID As Integer = 1

        If (parentNode Is Nothing) Then
            'Root element (use default root process Id)
            processId = PGW_ROOT_PROCESS_ID
            'Node element (use next process Id of parent)
            processId = Integer.Parse(GetPGWNodeDataItem(parentNode.NodeData, PGWNodeDataFields.NEXT_PRCS_ID))
        End If

        SelectedRows = pgwDataTable.Select("PRCS_ID = " & processId, "SEQ_NUM ASC")

        Dim PGWDataRow As DataRow

        For Each PGWDataRow In SelectedRows
            Dim tvNode As TreeNode = New TreeNode()
            Dim LeafNode As Boolean = False
            Dim IndexCode As String

            'Set the text and ID properties to the current row values
            tvNode.Text = PGWDataRow.Item("TEXT")
            IndexCode = PGWDataRow.Item("FORM_TYPE_INDX_CD").ToString.Trim
            If IndexCode.Length > 0 Then
                tvNode.Text += " (" & IndexCode & ")"
            End If
            tvNode.ID = PGWDataRow.Item("PRCS_GENR_WSTE_ID")

            'Store the next Process ID in the NodeData property
            If (Microsoft.VisualBasic.IsDBNull(PGWDataRow.Item("NEXT_PRCS_ID"))) Then
                'No next tree node, set done flag to true
                LeafNode = True
                tvNode.NodeData = " |" & PGWDataRow.Item("CSTT_SLCT_FLG") & "|" & PGWDataRow.Item("FORM_TYPE_INDX_CD") & "|" & PGWDataRow.Item("CONT_FLG") & "|" & PGWDataRow.Item("CTRL_NUM")
                tvNode.NodeData = PGWDataRow.Item("NEXT_PRCS_ID") & "|" & PGWDataRow.Item("CSTT_SLCT_FLG") & "|" & PGWDataRow.Item("FORM_TYPE_INDX_CD") & "|" & PGWDataRow.Item("CONT_FLG") & "|" & PGWDataRow.Item("CTRL_NUM")
            End If

            tvNode.DefaultStyle.Add("font-family", "Verdana")
            tvNode.DefaultStyle.Add("font-size", "8pt")

            If (parentNode Is Nothing) Then
                'Root element
                'Node element
            End If

            If Not (LeafNode) Then
                'Recursively call this method until all nodes are exhausted (depth-first)
                Call PopulatePGWTree(tvNode, processTypeId, pgwDataTable, treeView)
            End If
    End Sub

    ' METHOD:           GetPGWNodeDataItem
    ' DESCRIPTION:      
    '   nodeData        - Data from the PGW tree views .NodeData property
    '   index           - Index position of data to be retrieved from PGW NodeData
    Public Function GetPGWNodeDataItem(ByVal nodeData As String, ByVal index As PGWNodeDataFields) As String
        Dim ValueArray() As String

            ValueArray = nodeData.Split("|".ToCharArray())
            Return ValueArray(index)
        Catch exc As Exception
            Return ""
        End Try

    End Function

    ' METHOD:           PopulateListBox
    ' DESCRIPTION:      Populates a UI drop down list control with data
    '                   passed as a parameter to the method
    '   BoxData         - Data to populate list box
    '   ShowColumns     - Array of integers representing the elements
    '                     in BoxData that should be displayed to the user
    '   ValueColumns    - Array of integers representing the elements
    '                     in BoxData that should be stored in the .Value
    '                     property for each ListItem
    '   DropDown        - UI list box object to populate
    Public Sub PopulateListBox(ByRef BoxData As DataTable, ByVal ShowColumns() As Integer, ByVal ValueColumns() As Integer, ByRef DropDown As DropDownList)
        Dim LoopCounter As Integer
        Dim StartPosition As Integer = DropDown.Items.Count

        For LoopCounter = StartPosition To (StartPosition + (BoxData.Rows.Count - 1))
            Dim newItem As ListItem
            newItem = New ListItem()

            Dim ColumnCounter As Integer

            For Each ColumnCounter In ShowColumns
                If Not (Microsoft.VisualBasic.IsDBNull(BoxData.Rows(LoopCounter - StartPosition).Item(ColumnCounter))) Then
                    newItem.Text = newItem.Text & BoxData.Rows(LoopCounter - StartPosition).Item(ColumnCounter) & " " & DROP_DOWN_SPLIT_CHAR & " "
                End If

            ' Remove trailing /
            newItem.Text = Left(newItem.Text, newItem.Text.Length - 2)

            Dim ValueString As String = ""
            For Each ColumnCounter In ValueColumns
                ValueString = ValueString & BoxData.Rows(LoopCounter - StartPosition).Item(ColumnCounter) & "|"

            ' Remove trailing |
            newItem.Value = Left(ValueString, ValueString.Length - 1)

    End Sub

    ' METHOD:           PopulateListBox (overload
    ' DESCRIPTION:      Overloads the PopulateListBox method and allows
    '                   the caller to specify whether or not a default
    '                   first entry (no selection) is shown in the list
    '                   box.
    Public Sub PopulateListBox(ByRef BoxData As DataTable, ByVal ShowColumns() As Integer, ByVal ValueColumns() As Integer, ByRef DropDown As DropDownList, ByVal displayNoSelection As Boolean)

        If displayNoSelection Then
            Dim newItem As ListItem
            newItem = New ListItem()

            newItem.Text = DROP_DOWN_NO_SELECTION_TEXT
            newItem.Value = DROP_DOWN_NO_SELECTION

        End If

        Call PopulateListBox(BoxData, ShowColumns, ValueColumns, DropDown)
    End Sub

    Public Function GetTreeText(ByRef TreeViewObject As TreeView, ByVal TreeNodeIndex As String) As String
        Dim NodeIndexArray() As String
        Dim LoopCounter As Integer
        Dim Result As String
        Dim CurrentNodeList As TreeNodeCollection

        NodeIndexArray = TreeNodeIndex.Split(".")

        Result = ""
        CurrentNodeList = TreeViewObject.Nodes
        For LoopCounter = 0 To NodeIndexArray.Length - 1
            Result = Result & CurrentNodeList.Item(NodeIndexArray(LoopCounter)).Text & " " & DROP_DOWN_SPLIT_CHAR & " "

            CurrentNodeList = CurrentNodeList.Item(NodeIndexArray(LoopCounter)).Nodes

        If (Result.Length > 2) Then
            Result = Left(Result, Result.Length - 2)
        End If

        Return Result
    End Function

End Namespace