Csharp: TreeView 初始化设置默认选择节点
/// <summary>
/// 设置查找的节点为选定节点
/// 涂聚文
/// 2013-07-15
/// </summary>
/// <param name="trvToSrch"></param>
/// <param name="strToSrch"></param>
/// <returns></returns>
public TreeNode srchTxtInSelectTreeView(TreeView trvToSrch, String strToSrch)
{
// check if the treeView is not NULL
if (trvToSrch == null)
return null; // loop through the nodes in the treeview's root nodes
for (int i = 0; i < trvToSrch.Nodes.Count; i++)
{
TreeNode trvNode = srchTxtInSelectTreeViewNode(trvToSrch.Nodes[i], strToSrch);
if (trvNode != null)
return trvNode;
}
return null;
}
/// <summary>
/// 查找节点
/// </summary>
/// <param name="trvNode"></param>
/// <param name="strToSrch"></param>
/// <returns></returns>
public TreeNode srchTxtInSelectTreeViewNode(TreeNode trvNode, String strToSrch)
{
// check if the treeView is not NULL
if (trvNode == null)
return null; if (trvNode.Text == strToSrch)
return trvNode; // loop through the nodes in the treeview's sub nodes
for (int i = 0; i < trvNode.Nodes.Count; i++)
{
// recursive call to itself to check lower level nodes
TreeNode retTrvNode = srchTxtInSelectTreeViewNode(trvNode.Nodes[i], strToSrch);
if (retTrvNode != null)
return retTrvNode;
}
return null;
}
//TreeView初始化设置默认选择节点
treeView1.SelectedNode = srchTxtInSelectTreeView(treeView1, "深圳");
Csharp: TreeView 初始化设置默认选择节点的更多相关文章
- Jquery-下拉列表设置默认选择
$('#select option:eq(2)').attr('selected','selected');
- ngular ionic select ng-options 默认选择第一个值的写法
1. html <select ng-model="selectOrderState" style="border:none;left:0" ng-opt ...
- php一些单选、复选框的默认选择方法(示例)
转载 http://www.php.cn/php-weizijiaocheng-360029.html 一. radio和checkbox及php select默认选择的实现代码 1.radio单选框 ...
- 官方yum源安装选择所需版本mysql数据库并初始化(yum默认安装的是最新版MySQL8.+)
在官网是找不到5.x系列的域名源的,系统默认是安装的oracle数据库,在安装前需要删除默认的 以下教程来源于官网说明 先去官网下载yum源,地址 https://dev.mysql.com/down ...
- 【转载】win10解决设置默认打开方式不生效问题(双击每次都要选择默认打开程序)
win10解决设置默认打开方式不生效问题(双击每次都要选择默认打开程序) 以下文章 部分选自 https://blog.csdn.net/shan165310175/article/details/8 ...
- Confluence 6 配置推荐更新邮件通知默认的初始化设置
Confluence 为订阅者发送常规邮件报告,这个邮件报告中包含有用户具有查看权限的空间的最新的内容.这个被称为 推荐更新(Recommended Updates)通知. 如果你具有 Conflue ...
- c#为字段设置默认值,以及构造函数初始化List对象。
1.为字段设置默认值 /// <summary> /// 默认值 /// </summary> ; ; /// <summary> /// 页的大小 /// < ...
- 取消IDEA默认打开最近的项目(设置打开选择创建页面)
Ctrl + Shift + s 打开设置界面 选择Appearance&Behavior 找到System Settings 将Reopen last project on startup ...
- BW标准数据源初始化设置
在安装了一干补丁和做好了BW与R3的链接之后(此处有BISIS操心,具体事宜不详),我们就可以登录到R3系统看个究竟了. 磨刀不误砍柴工,先检查一下两边系统的补丁: R3端如下, ,貌似我们是19,通 ...
随机推荐
- MD5和SHA-1
MD5和SHA-1都是我们耳熟能详的术语了,很多人可能知道他们跟加密有关系,但是他们是怎么做到加密的,他们各自的特点又是什么.我来简单的讲一讲. MD5和SHA-1都被称作哈希(Hash)函数,用过J ...
- SDUT OJ 数据结构实验之图论十:判断给定图是否存在合法拓扑序列
数据结构实验之图论十:判断给定图是否存在合法拓扑序列 Time Limit: 1000 ms Memory Limit: 65536 KiB Submit Statistic Discuss Prob ...
- Eclipse 使用TFS
Install Soft , –> add http://dl.microsoft.com/eclipse/tfs form:http://msdn.microsoft.com/en-us/ ...
- C++_标准模板库STL概念介绍2-泛型编程
有了之前使用STL的经验后,接下来讨论泛型编程及其底层的理念: 首先我们知道STL只是泛型编程的一种: 而面向对象的编程方式关注的是编程的数据方面: 而泛型编程关注的是算法: 但是,他们之间的一个重要 ...
- [BZOJ 5330][SDOI2018] 反回文串
传送门 怎么说呢,一道不可多得的反演题吧,具体解释之后再补 #include <bits/stdc++.h> using namespace std; #define rep(i,a,b) ...
- angular model-dialog 关闭按钮
<button class="close" data-dismiss="modal" type="button" aria-label ...
- URL 地址传中文,转码
地址传中文,转码 http://community.csdn.net/Expert/topic/4541/4541877.xml?temp=.57688541.设置web.config文件.<s ...
- poj2420 A Star not a Tree? 找费马点 模拟退火
题目传送门 题目大意: 给出100个二维平面上的点,让你找到一个新的点,使这个点到其他所有点的距离总和最小. 思路: 模拟退火模板题,我也不懂为什么,而且一个很有意思的点,就是初始点如果是按照我的代码 ...
- 2018年江西理工大学C语言程序设计竞赛(初级组)一
C语言竞赛初级组第一.二场答案:https://www.cnblogs.com/xingkongyihao/p/10046918.html A: 逆序对 时间限制: 1 s 内存限制: ...
- BZOJ - 2648 KD树 最近点查询
省赛后躺尸几天又回来更新了,内容是说好的KD树.. 具体操作从代码中感受一下 感觉已经把KD树尽量封装好了(虽然全局的D看着极不顺眼) 需要注意的是估值函数的判断条件 #include<bits ...