private void btnSearchConfirm_Click(object sender, EventArgs e) { try { if (LastKey != txtSearchTitle.Text || dr == null || dr.Length == 0) { LastKey = txtSearchTitle.Text; SearchIndex = 0; DataSet ds = treeFactory.GetDS(Globals.ProjectNO, txtSearchTitle.Text); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { dr = ds.Tables[0].Select();//("title like '%" + txtSearchTitle.Text + "%'", "length,orderindex"); } else { MyCommon.Show("未找到任何符合关键字的记录!"); return; } } if (SearchIndex >= dr.Length) { SearchIndex = 0; } if (dr != null && dr.Length > 0) { DataRow dr1 = dr[SearchIndex++]; string obj = ""; obj = dr1["id"].ToString(); TreeNodeCollection pNodes = tree.Nodes; for (int i1 = 2; i1 <= obj.Length; i1 += 2) { string nodeID = obj.Substring(0, i1); pNodes = SearchAndExpendNode(pNodes, nodeID); } tree.SelectedNode.Name = obj; } } catch (Exception) { TX.Framework.WindowUI.Forms.TXMessageBoxExtensions.Info("未找到任何符合关键字的记录!"); } }