具有动态树节点的递归函数

发布于 2024-11-29 23:44:09 字数 360 浏览 2 评论 0原文

我有一个递归函数,其目标是扫描一个结构并用树节点表示该结构。

我的函数内部取决于结构,我必须在我的树节点内创建另一个树节点,或者只创建一个节点。

我的问题是,当我必须再次调用我的函数时,我不知道如何记住我的树节点位置。

    If strTop.TextString.ToUpper = "DMN" Then

        gcTreeno.Nodes.Add("Node")

    Else
        Dim perf As New TreeNode
        gcTreeno.Nodes.Add(perf)

    End If

如果我想下次将节点写入 perf,我该怎么做?

I have a recursive function wich objective is scann an structure and represent that structure with treenodes.

Inside my function depends the structure I'll have to create another treenode inside my treenode or just create a node.

My problem is that I don't know how to remember my treenode position when I have to call my function again.

    If strTop.TextString.ToUpper = "DMN" Then

        gcTreeno.Nodes.Add("Node")

    Else
        Dim perf As New TreeNode
        gcTreeno.Nodes.Add(perf)

    End If

if i would like to write next time a node into perf, how i could do it ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

心舞飞扬 2024-12-06 23:44:09

只需检查其他功能..您可以将键值传递给您的节点。

就像 gcTreeno.Nodes.Add("key", "text")

Just check the other functions .. you can pass a Key Value to your node.

like gcTreeno.Nodes.Add("key", "text")

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文