private void btnEditName_Click(object sender, System.EventArgs e) { if (this.lsvWell.SelectedItems.Count <= 0) { MessageBox.Show("请选择要发卡的监测站!"); return; } string strWellNo = this.lsvWell.SelectedItems[0].SubItems[0].Text.Trim(); string strDepName = this.lsvWell.SelectedItems[0].SubItems[2].Text.Trim(); frmZhan frmZO = new frmZhan(); frmZO.m_strZhanNo = strWellNo; frmZO.ShowDialog(); string strSql = string.Format("select depname from tbWell where wellNo='{0}'", strWellNo); string strWellName = BengZhan.CDBConnection.ExecuteScalar(strSql).Trim(); cmbCountry_SelectedIndexChanged(null, null); for (int i = 0; i < this.trvDep.Nodes[0].Nodes.Count; i++) { if (this.trvDep.Nodes[0].Nodes[i].Text.Trim().IndexOf(strWellName) >= 0) { this.trvDep.SelectedNode = this.trvDep.Nodes[0].Nodes[i]; } } this.trvDep_AfterSelect(null, null); }
private void btnEditName_Click(object sender, System.EventArgs e) { if(this.lsvWell.SelectedItems.Count<=0) { MessageBox.Show("��ѡ��Ҫ�����ļ��վ��"); return; } string strWellNo=this.lsvWell.SelectedItems[0].SubItems[0].Text.Trim(); string strDepName=this.lsvWell.SelectedItems[0].SubItems[2].Text.Trim(); frmZhan frmZO=new frmZhan(); frmZO.m_strZhanNo=strWellNo; frmZO.ShowDialog(); string strSql=string.Format("select depname from tbWell where wellNo='{0}'",strWellNo); string strWellName=BengZhan.CDBConnection.ExecuteScalar(strSql).Trim(); cmbCountry_SelectedIndexChanged(null,null); for(int i=0;i<this.trvDep.Nodes[0].Nodes.Count;i++) { if(this.trvDep.Nodes[0].Nodes[i].Text.Trim().IndexOf(strWellName)>=0) { this.trvDep.SelectedNode=this.trvDep.Nodes[0].Nodes[i]; } } this.trvDep_AfterSelect(null,null); }