使用Winforms / VB从Datatable构建分层Treeview [英] Hierarchical Treeview build from Datatable using Winforms / VB
问题描述
大家好,
我有一个SQL表(称为tblClosure),其中包含以下字段:
1.LocationID
2.LocationDesc
3.ParentID
我的问题是如何在winforms中填充此数据表中的树视图控件/ VB?我在c#中看过一些例子,但我是一名新手编码器,我很难适应这些代码。
任何帮助都会非常感激。
理想情况下,我需要的是一个VB子程序来构建表中的TReeview层次结构。我已经看到这是C#但我很难转换为VB。
提前谢谢
Hi All,
I have a SQL table (called tblClosure) which has these fields:
1.LocationID
2.LocationDesc
3.ParentID
My question is how can I populate a treeview control from this datatable in winforms/vb? I have seen examples in c# but I'm a rookie coder and am having difficulties adapting that code.
Any help would be greatly appreciated.
Ideally all I need is a VB sub to build the TReeview Hierarchy from the table. I have seen this is C# but am struggling to convert to VB.
Thanks in advance
推荐答案
如果您了解VB.NET而不是C#,那么在实践中这是非常糟糕的。如果您需要帮助或寻找一些可用的代码示例,大多数最佳解决方案都在C#中,而不是VB.NET,这些都经常不被认真对待。只是现实生活的事实。所以,你真的需要了解至少一些C#。
至于翻译,它可以很容易地完成。在我过去的答案中,我提出了一些在线解决方案和一个非常好的全面的离线解决方案(开源ILSpy:它提供了出色的翻译结果,以及所有来源的即用型项目的形式代码文件):
C#到VB.NET的COde行解释 [ ^ ],
需要将vb代码转换为c# [ ^ ],
固定页面ContentPage将c#代码转换为vb.net [ ^ ],
源代码来自一个exe [ ^ ]。
-SA
If you understand VB.NET and not C#, this is pretty bad in practice. If you want help or look for some available code samples, the most of best solutions are in C#, not VB.NET, which are often is not taken seriously. Just the fact of real life. So, you really need to understand at least some of C#.
As to translation, it can be done easily enough. In my past answers, I suggested some on-line solutions and one really good and comprehensive off-line solution (open source ILSpy: it provides excellent translation results in no time, in the form of a ready-to-use project with all source code files):
COde Line Interpretatio of C# to VB.NET[^],
Need to convert vb code to c#[^],
FixedPage to ContentPage convert c# code into vb.net[^],
Source Code from a exe[^].
—SA
这篇关于使用Winforms / VB从Datatable构建分层Treeview的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!