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,通 ...
随机推荐
- Linux 调节分辨率
首先,你要有 GUI 才能设置分辨率 Tool of xrandr xrandr -s 1360x768
- Servlet的概念与用法
Servlet: Servlet(Servlet+Applet) Servlet是一种独立于平台和协议的服务器端Java应用程序,通用Servlet 可以生成动态Web页面.Servlet还 ...
- js 有用信息集
1.java.cookie.js 库:轻易操作cookie 2.jquery.form.js 库:通过ajaxForm,ajaxsubmit 两个函数,将form转为ajax提交方式:https:// ...
- TextInput
TextInput /** TextInput 是一个允许用户在应用中通过键盘输入文本的基本组件* 本组件的属性提供了多种特性的配置,如自动完成,自动大小写,占位文字,键盘类型等* 常用:* plac ...
- java 开发原则(七个)
转自 : https://blog.csdn.net/u011288271/article/details/52497602 对于Java看到过一个很有意思的说法:Java有六大心法,23种武功招式. ...
- python之常用的数据类型
1. 变量的定义以及声明 在学习变量之前,咱们需要知道变量的命名规则: ① 变量必须由数字字母下划线构成,如a_1 ② 变量名不能以数字开头,如1a ③ 需要遵循驼峰命名法 给变量赋值通常采用“=”, ...
- oracle数据库导入dmp文件
最近在自己的机子上安装了oracle11g,今天把项目的测试数据库给导入进来了,方便在本地跑起来调试.下面记录一下过程: 1,导出测试数据库的文件; 这个是在公司三楼的一台机子上,用plsql中的工具 ...
- Game of Credit Cards(贪心+思维)
After the fourth season Sherlock and Moriary have realized the whole foolishness of the battle betwe ...
- srping 事物管理
1. 准备工作 1> 添加接口 BookShopDao package com.tx; public interface BookShopDao { //根据书号获取书的单价 public in ...
- 基于PHPExcel的常用方法总结
// 通常PHPExcel对象有两种实例化的方式// 1. 通过new关键字创建空白文档$phpexcel = newPHPExcel();// 2. 通过读取已有的模板创建$phpexcel =PH ...