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,通 ...
随机推荐
- 1. C/C++项目一
需求: 使用C语言封装string 字符串,实现字符串的增.删.改.查等API函数. 要求: 不能使用 string 库函数,所有库函数必须自己手动实现. [项目实现] myString.h 代码如下 ...
- 报表中经常遇到的一个头疼的问题是需要自动选择过去一个月的数据作为当前报表输出。网上查询了一些.NET 的C#例子,发现都实现的比较复杂
报表中经常遇到的一个头疼的问题是需要自动选择过去一个月的数据作为当前报表输出.网上查询了一些.NET 的C#例子,发现都实现的比较复杂,其实这个问题可以很简单的通过.NET的DateTime函数来实现 ...
- JAVA 大数 A+B问题
A + B Problem II I have a very simple problem for you. Given two integers A and B, your job is to ca ...
- bzoj3262 陌上花开 cdq分治(入门)
题目传送门 思路:cdq分治处理偏序关系的模板题,主要就是学cdq分治吧,还在入门中. 代码其实也很好理解,记得树状数组操作的上限是 z的最大值,不是n的最大值,这个细节wa了好久. #include ...
- adb自救指南
以下只能自救专用 adb.exe root adb remount adb.exe connect <Ip> adb.exe install [-r] [-d] <apkPath&g ...
- [转] 一文看懂npm、yarn、pnpm之间的区别
[From] http://geek.csdn.net/news/detail/197339 原文:Understanding differences between npm, yarn and pn ...
- Oracle Pipelined Table Functions简介
转自: http://www.linuxidc.com/Linux/2011-05/35797.htm //概况 //基本上,当你希望一个PLSQL(或者java或者c)程序作为数据源,而不是表, ...
- 【Python】txt数据处理
实战场景 使用safe3wvs扫描,扫描完成后会在当前目录下生成一个日志文件spider.log,截图如下. 现要求将存在sql注入的url地址整理到spider_new.log文件中,下面分享一个自 ...
- PIE SDK神经网络聚类
1.算法功能简介 神经网络是模仿人脑神经系统的组成方式与思维过程而构成的信息处理系统,具有非线性.自学性.容错性.联想记忆和可以训练性等特点.在神经网络中,知识和信息的传递是由神经元的相互连接来实现的 ...
- 理解fig,ax = plt.subplots()
fig = plt.figure() ax = fig.add_subplot(1,1,1) fig, ax = plt.subplots(1,3),其中参数1和3分别代表子图的行数和列数,一共有 1 ...