亲,帮我详细看一下vb代码吧,谢谢
Private Sub CMDFind_Click()Dim USEID As String, Usename As String, i As Integer
USEID = Trim(TXTUseID.Text): Usename = TXTUseName.Text
If Check1.Value = 1 And Check2.Value = 1 Then
For i = 1 To OrgTree.Nodes.Count
If USEID = OrgTree.Nodes(i).Key And InStr(OrgTree.Nodes(i).Text, Usename) > 0 Then
OrgTree.Nodes(i).Selected = True
OrgTree_NodeClick OrgTree.Nodes(i)
End If
Next i
ElseIf Check1.Value = 1 Then
For i = 1 To OrgTree.Nodes.Count
If USEID = OrgTree.Nodes(i).Key Then
OrgTree.Nodes(i).Selected = True
OrgTree_NodeClick OrgTree.Nodes(i)
End If
Next i
Else
For i = 1 To OrgTree.Nodes.Count
If InStr(OrgTree.Nodes(i).Text, Usename) > 0 Then
OrgTree.Nodes(i).Selected = True
OrgTree_NodeClick OrgTree.Nodes(i)
End If
Next i
End If
OrgTree.SetFocus
End Sub --------------------编程问答-------------------- --------------------编程问答-------------------- --------------------编程问答-------------------- 回复次数2,可是我怎么没看到回复呢? --------------------编程问答-------------------- '**************************************************************************
'
'作用:根据复选框check1和check2的选择情况选择验证方式进行查找对应的OrgTree节点
' 选择节点并产生单击事件
'
'**************************************************************************
Private Sub CMDFind_Click()
Dim USEID As String, Usename As String, i As Integer '定义需要使用到的变量
USEID = Trim(TXTUseID.Text) '用户ID,文本框TXTUseID输入
Usename = TXTUseName.Text '用户名,文本框TXTUseName输入
'下面这段代码意思是用户ID和用户名ID均需要进行验证
If Check1.Value = 1 And Check2.Value = 1 Then '判断是否两个复选框是否都选择
For i = 1 To OrgTree.Nodes.Count '查询控件OrgTree所有节点
If USEID = OrgTree.Nodes(i).Key And InStr(OrgTree.Nodes(i).Text, Usename) > 0 Then '用户ID和用户名是否均对应,均对应就选择并且产生单击事件
OrgTree.Nodes(i).Selected = True
OrgTree_NodeClick OrgTree.Nodes(i)
End If
Next i
'下面这段代码意思仅需要验证用户ID
ElseIf Check1.Value = 1 Then
For i = 1 To OrgTree.Nodes.Count
If USEID = OrgTree.Nodes(i).Key Then
OrgTree.Nodes(i).Selected = True
OrgTree_NodeClick OrgTree.Nodes(i)
End If
Next i
'下面这段代码意思仅需要验证用户名
Else
For i = 1 To OrgTree.Nodes.Count
If InStr(OrgTree.Nodes(i).Text, Usename) > 0 Then
OrgTree.Nodes(i).Selected = True
OrgTree_NodeClick OrgTree.Nodes(i)
End If
Next i
End If
OrgTree.SetFocus
End Sub --------------------编程问答--------------------
'**************************************************************************
'
'作用:根据复选框check1和check2的选择情况选择验证方式进行查找对应的OrgTree节点
' 选择节点并产生单击事件
'
'**************************************************************************
Private Sub CMDFind_Click()
Dim USEID As String, Usename As String, i As Integer '定义需要使用到的变量
USEID = Trim(TXTUseID.Text) '用户ID,文本框TXTUseID输入
Usename = TXTUseName.Text '用户名,文本框TXTUseName输入
'下面这段代码意思是用户ID和用户名ID均需要进行验证
If Check1.Value = 1 And Check2.Value = 1 Then '判断是否两个复选框是否都选择
For i = 1 To OrgTree.Nodes.Count '查询控件OrgTree所有节点
If USEID = OrgTree.Nodes(i).Key And InStr(OrgTree.Nodes(i).Text, Usename) > 0 Then '用户ID和用户名是否均对应,均对应就选择并且产生单击事件
OrgTree.Nodes(i).Selected = True
OrgTree_NodeClick OrgTree.Nodes(i)
End If
Next i
'下面这段代码意思仅需要验证用户ID
ElseIf Check1.Value = 1 Then
For i = 1 To OrgTree.Nodes.Count
If USEID = OrgTree.Nodes(i).Key Then
OrgTree.Nodes(i).Selected = True
OrgTree_NodeClick OrgTree.Nodes(i)
End If
Next i
'下面这段代码意思仅需要验证用户名
Else
For i = 1 To OrgTree.Nodes.Count
If InStr(OrgTree.Nodes(i).Text, Usename) > 0 Then
OrgTree.Nodes(i).Selected = True
OrgTree_NodeClick OrgTree.Nodes(i)
End If
Next i
End If
OrgTree.SetFocus
End Sub
补充:VB , 控件