📄 frmwizardnumericattributes.frm
字号:
Exit_ErrorHandler:
Exit Sub
ErrorHandler:
ErrorManager.ErrorHandler Err, _
"cmdNext_Click.frmWizardNumericAttributes"
Resume Exit_ErrorHandler
End Sub
Private Sub Form_Load()
On Error GoTo ErrorHandler
Dim strTable As String
Dim varAttributes() As Variant
Dim strNode As String
Dim Nodx As Node
Dim lngCount As Long
'The tree view control used for classification will use check boxes
tvwAttributes.Checkboxes = True
'Get the selected table's name
strTable = DataMiningServer.TableSelected
'Get the selected attributes
varAttributes = DataMiningServer.AttributesSelected
If strTable <> "" Then
' The root node
Set Nodx = tvwAttributes.Nodes.Add(, , "root")
Nodx.Text = strTable
Nodx.Tag = "Selected Table"
Nodx.Expanded = True
Nodx.Sorted = True
Nodx.Bold = True
Nodx.Checked = True
'Root Node For Non Numeric Attributes
Set Nodx = tvwClassPredict.Nodes.Add(, , "NonNumeric")
Nodx.Text = "Non Numeric Attributes"
Nodx.Tag = "Non Numeric Attributes"
Nodx.Expanded = True
Nodx.Sorted = True
Nodx.Bold = True
Nodx.Checked = False
'Root Node For Numeric Attributes
Set Nodx = tvwClassPredict.Nodes.Add("NonNumeric", tvwNext, "Numeric")
Nodx.Text = "Numeric Attributes"
Nodx.Tag = "Numeric Attributes"
Nodx.Expanded = True
Nodx.Sorted = True
Nodx.Bold = True
Nodx.Checked = False
'Only the previously selected attributes will be available
For lngCount = LBound(varAttributes) To UBound(varAttributes)
strNode = varAttributes(lngCount)
' This next node is a child of the root node (root).
Set Nodx = tvwAttributes.Nodes.Add("root", tvwChild, , strNode)
'Tag the Node
Nodx.Tag = strNode
'Expand the parent node
'nodX.Parent.Expanded = True
'Add The Node To The Non Numeric Node
Set Nodx = tvwClassPredict.Nodes.Add("NonNumeric", tvwChild)
'The text to display for the Node
Nodx.Text = strNode
'Tag the Node
Nodx.Tag = strNode
Next
End If
Exit_ErrorHandler:
Exit Sub
ErrorHandler:
ErrorManager.ErrorHandler Err, _
"Form_Load.frmWizardNumericAttributes"
Resume Exit_ErrorHandler
End Sub
Private Sub tvwAttributes_NodeCheck(ByVal Node As MSComctlLib.Node)
On Error GoTo ErrorHandler
'This procedures runs when a Node is checked
'or unchecked in the Tree View
Dim strNode As String
Dim strTable As String
Dim lngIndex As Long
Dim fld As ADODB.Field
Dim rstSchema As ADODB.Recordset
Dim Nodx As Node
Dim blnCheck As Boolean
'If the Root Node is selected, then exit
If Node = Node.Root Then Exit Sub
'If the parent node is not the root node, then exit
If Not Node.Parent = Node.Root Then Exit Sub
'If no field is selected then exit
If Node.Text = "" Then Exit Sub
lngIndex = Node.Index
'The name of the node selected
strNode = Node.Text
'The check state of the node
blnCheck = Node.Checked
If blnCheck = True Then
For Each Node In tvwClassPredict.Nodes
If (Node.Text = strNode) _
And (Node <> "Numeric Attributes") _
And (Node <> "Non Numeric Attributes") Then
lngIndex = Node.Index
'Remove The Node From The Non Numeric Node
tvwClassPredict.Nodes.Remove lngIndex
'Add The Node To The Numeric Node
Set Nodx = tvwClassPredict.Nodes.Add("Numeric", tvwChild)
'The text to display for the Node
Nodx.Text = strNode
'Tag the Node
Nodx.Tag = strNode
Exit For
End If
Next
Else
'The node deselected must be removed from the
'Numeric Root And Added To The Non Numeric Root
For Each Node In tvwClassPredict.Nodes
If (Node.Text = strNode) _
And (Node <> "Numeric Attributes") _
And (Node <> "Non Numeric Attributes") Then
lngIndex = Node.Index
'Remove The Node From The Numeric Node
tvwClassPredict.Nodes.Remove lngIndex
'Add The Node To The Non Numeric Node
Set Nodx = tvwClassPredict.Nodes.Add("NonNumeric", tvwChild)
'The text to display for the Node
Nodx.Text = strNode
'Tag the Node
Nodx.Tag = strNode
Exit For
End If
Next
End If
'Create a List Of Numeric And
'Non Numeric Selections
Call TreeView_Selection
Exit_ErrorHandler:
Exit Sub
ErrorHandler:
ErrorManager.ErrorHandler Err, _
"tvwAttributes_NodeCheck.frmWizardNumericAttributes"
Resume Exit_ErrorHandler
End Sub
Private Function TreeView_Selection()
On Error GoTo ErrorHandler
'Create a list of the numeric and
'non numeric attributes selected
Dim strNumeric() As String
Dim strNonNumeric() As String
Dim CountNumeric As Long
Dim CountNonNumeric As Long
For Each Node In tvwClassPredict.Nodes
If (Node <> "Numeric Attributes") _
And (Node <> "Non Numeric Attributes") Then
If (Node.Parent = "Numeric Attributes") Then
'List Of Numeric Attributes
ReDim Preserve strNumeric(CountNumeric)
strNumeric(CountNumeric) = Node.Text
CountNumeric = CountNumeric + 1
Else
'List Of Non Numeric Attributes
ReDim Preserve strNonNumeric(CountNonNumeric)
strNonNumeric(CountNonNumeric) = Node.Text
CountNonNumeric = CountNonNumeric + 1
End If
End If
Next
'Store the list of the numeric attributes selected
DataMiningServer.NumericAttributes = strNumeric()
DataMiningServer.CountOfNumericAttributes = CountNumeric
'Store the list of the non numeric attributes selected
DataMiningServer.NonNumericAttributes = strNonNumeric()
DataMiningServer.CountOfNonNumericAttributes = CountNonNumeric
Exit_ErrorHandler:
Exit Function
ErrorHandler:
ErrorManager.ErrorHandler Err, _
"TreeView_Selection.frmWizardNumericAttributes"
Resume Exit_ErrorHandler
End Function
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -