Public Class frmTreeSearchResult
    Public searchResultNodes As List(Of TreeNode)
    Public constructorForm As frmConstructor_Main

    Private Sub frmTreeSearchResult_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        listBoxResults.Focus()

        searchResultNodes.ForEach(Sub(resultNode)
                                      listBoxResults.Items.Add(resultNode.Text)
                                  End Sub)
    End Sub

    Private Sub listBoxResults_KeyUp(sender As Object, e As KeyEventArgs) Handles listBoxResults.KeyUp
        If e.KeyCode = Keys.Escape Then
            DialogResult = DialogResult.Cancel
            Close()
        End If
    End Sub

    Private Sub SetSelectedNode(nodeName As String)
        Dim node = searchResultNodes.Find(Function(n As TreeNode)
                                              Return n.Text = nodeName
                                          End Function)
        constructorForm.SetSelectedTreeViewNode(node)
    End Sub

    Private Sub listBoxResults_SelectedIndexChanged(sender As Object, e As EventArgs) Handles listBoxResults.SelectedIndexChanged
        Dim name As String = listBoxResults.SelectedItem
        SetSelectedNode(name)
    End Sub
End Class