TreeView.FindNode メソッド
アセンブリ: System.Web (system.web.dll 内)

Dim instance As TreeView Dim valuePath As String Dim returnValue As TreeNode returnValue = instance.FindNode(valuePath)
戻り値
指定した値パスにある TreeNode。

FindNode メソッドを使用して、指定された値パスにある TreeView コントロールからノードを取得します。値パスには、ルート ノードから現在のノードまでのパスを構成するノードの値のコンマ区切りのリストが格納されます。各ノードの ValuePath プロパティには、ノードの値パスが格納されます。PathSeparator プロパティは、ノードの値を区切るための区切り文字を指定します。

FindNode メソッドを使用して、TreeView コントロールからノードを取得するコード例を次に示します。
<%@ Page Language="VB" %> <script runat="server"> Sub Button_Click(ByVal sender As Object, ByVal e As EventArgs) ' Find the node specified by the user. Dim node As TreeNode = LinksTreeView.FindNode(Server.HtmlEncode(ValuePathText.Text)) If Not node Is Nothing Then ' Indicate that the node was found. Message.Text = "The specified node (" & node.ValuePath & ") was found." Else ' Indicate that the node is not in the TreeView control. Message.Text = "The specified node (" & ValuePathText.Text & ") is not in this TreeView control." End If End Sub </script> <html> <body> <form runat="server"> <h3>TreeView FindNode Example</h3> <asp:TreeView id="LinksTreeView" PathSeparator="\" Font-Names= "Arial" ForeColor="Blue" runat="server"> <LevelStyles> <asp:TreeNodeStyle ChildNodesPadding="10" Font-Bold="true" Font-Size="12pt" ForeColor="DarkGreen"/> <asp:TreeNodeStyle ChildNodesPadding="5" Font-Bold="true" Font-Size="10pt"/> <asp:TreeNodeStyle ChildNodesPadding="5" Font-UnderLine="true" Font-Size="10pt"/> <asp:TreeNodeStyle ChildNodesPadding="10" Font-Size="8pt"/> </LevelStyles> <Nodes> <asp:TreeNode Text="Table of Contents" SelectAction="None"> <asp:TreeNode Text="Chapter One" Value="Chapter One"> <asp:TreeNode Text="Section 1.0" Value="Section 1.0"> <asp:TreeNode Text="Topic 1.0.1" Value="Topic 1.0.1"/> <asp:TreeNode Text="Topic 1.0.2" Value="Topic 1.0.2"/> <asp:TreeNode Text="Topic 1.0.3" Value="Topic 1.0.3"/> </asp:TreeNode> <asp:TreeNode Text="Section 1.1"> <asp:TreeNode Text="Topic 1.1.1" Value="Topic 1.1.1"/> <asp:TreeNode Text="Topic 1.1.2" Value="Topic 1.1.2"/> <asp:TreeNode Text="Topic 1.1.3" Value="Topic 1.1.3"/> <asp:TreeNode Text="Topic 1.1.4" Value="Topic 1.1.4"/> </asp:TreeNode> </asp:TreeNode> <asp:TreeNode Text="Chapter Two" Value="Chapter Two"> <asp:TreeNode Text="Section 2.0" Value="Section 2.0"> <asp:TreeNode Text="Topic 2.0.1" Value="Topic 2.0.1"/> <asp:TreeNode Text="Topic 2.0.2" Value="Topic 2.0.2"/> </asp:TreeNode> </asp:TreeNode> </asp:TreeNode> <asp:TreeNode Text="Appendix A" /> <asp:TreeNode Text="Appendix B" /> <asp:TreeNode Text="Appendix C" /> </Nodes> </asp:TreeView> <hr> <br><br> Enter the value path of the node to locate. <br> Use a backslash (\) to delimit each node value.<br> <asp:TextBox id="ValuePathText" Text="Table of Contents\Chapter One\Section 1.0" Width="50%" runat="server"/> <br><br> <asp:Button id="Submit" Text="Find Node" OnClick="Button_Click" runat="server"/> <br><br> <asp:Label id="Message" runat="server"/> </form> </body> </html>
<%@ Page Language="C#" %> <script runat="server"> void Button_Click(Object sender, EventArgs e) { // Find the node specified by the user. TreeNode node = LinksTreeView.FindNode(Server.HtmlEncode(ValuePathText.Text)); if (node != null) { // Indicate that the node was found. Message.Text = "The specified node (" + node.ValuePath + ") was found."; } else { // Indicate that the node is not in the TreeView control. Message.Text = "The specified node (" + ValuePathText.Text + ") is not in this TreeView control."; } } </script> <html> <body> <form runat="server"> <h3>TreeView FindNode Example</h3> <asp:TreeView id="LinksTreeView" PathSeparator="\" Font-Names= "Arial" ForeColor="Blue" runat="server"> <LevelStyles> <asp:TreeNodeStyle ChildNodesPadding="10" Font-Bold="true" Font-Size="12pt" ForeColor="DarkGreen"/> <asp:TreeNodeStyle ChildNodesPadding="5" Font-Bold="true" Font-Size="10pt"/> <asp:TreeNodeStyle ChildNodesPadding="5" Font-UnderLine="true" Font-Size="10pt"/> <asp:TreeNodeStyle ChildNodesPadding="10" Font-Size="8pt"/> </LevelStyles> <Nodes> <asp:TreeNode Text="Table of Contents" SelectAction="None"> <asp:TreeNode Text="Chapter One" Value="Chapter One"> <asp:TreeNode Text="Section 1.0" Value="Section 1.0"> <asp:TreeNode Text="Topic 1.0.1" Value="Topic 1.0.1"/> <asp:TreeNode Text="Topic 1.0.2" Value="Topic 1.0.2"/> <asp:TreeNode Text="Topic 1.0.3" Value="Topic 1.0.3"/> </asp:TreeNode> <asp:TreeNode Text="Section 1.1"> <asp:TreeNode Text="Topic 1.1.1" Value="Topic 1.1.1"/> <asp:TreeNode Text="Topic 1.1.2" Value="Topic 1.1.2"/> <asp:TreeNode Text="Topic 1.1.3" Value="Topic 1.1.3"/> <asp:TreeNode Text="Topic 1.1.4" Value="Topic 1.1.4"/> </asp:TreeNode> </asp:TreeNode> <asp:TreeNode Text="Chapter Two" Value="Chapter Two"> <asp:TreeNode Text="Section 2.0" Value="Section 2.0"> <asp:TreeNode Text="Topic 2.0.1" Value="Topic 2.0.1"/> <asp:TreeNode Text="Topic 2.0.2" Value="Topic 2.0.2"/> </asp:TreeNode> </asp:TreeNode> </asp:TreeNode> <asp:TreeNode Text="Appendix A" /> <asp:TreeNode Text="Appendix B" /> <asp:TreeNode Text="Appendix C" /> </Nodes> </asp:TreeView> <hr> <br><br> Enter the value path of the node to locate. <br> Use a backslash (\) to delimit each node value.<br> <asp:TextBox id="ValuePathText" Text="Table of Contents\Chapter One\Section 1.0" Width="50%" runat="server"/> <br><br> <asp:Button id="Submit" Text="Find Node" OnClick="Button_Click" runat="server"/> <br><br> <asp:Label id="Message" runat="server"/> </form> </body> </html>

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からTreeView.FindNode メソッドを検索する場合は、下記のリンクをクリックしてください。

- TreeView.FindNode メソッドのページへのリンク