读书人

第一个If话语能执行成功为什么后两个

发布时间: 2012-12-30 10:43:15 作者: rapoo

第一个If语句能执行成功,为什么后两个不执行?(点击按钮时,选择哪个节点就显示相应内容)
本帖最后由 bcrun 于 2012-11-18 12:40:19 编辑 代码如下:第一个If语句能执行成功,为什么后两个不执行?(点击按钮时,选择哪个节点就显示相应内容)

If TreeView1.Nodes.Count > 0 Then
Select Case TreeView1.SelectedItem
Case "单选题"
Text1.Text = "信息单选题"
Case "多选题"
Text1.Text = "信息多选题"
Case "判断题"
Text1.Text = "信息判断题"
End Select
Else
If TreeView2.Nodes.Count > 0 Then
Select Case TreeView2.SelectedItem
Case "单选题"
Text1.Text = "Word单选题"
Case "多选题"
Text1.Text = "Word多选题"
Case "判断题"
Text1.Text = "Word判断题"
End Select
Else
If TreeView3.Nodes.Count > 0 Then
Select Case TreeView3.SelectedItem
Case "单选题"
Text1.Text = "Excel单选题"
Case "多选题"
Text1.Text = "Excel多选题"
Case "判断题"
Text1.Text = "Excel判断题"
End Select
End If
End If
End If

[解决办法]
本帖最后由 bcrun 于 2012-11-18 12:41:03 编辑
If TreeView1.Nodes.Count > 0 Then
Select Case TreeView1.SelectedItem
Case "单选题"
Text1.Text = "信息单选题"
Case "多选题"
Text1.Text = "信息多选题"
Case "判断题"
Text1.Text = "信息判断题"
End Select
endif
If TreeView2.Nodes.Count > 0 Then
Select Case TreeView2.SelectedItem
Case "单选题"
Text1.Text = "Word单选题"
Case "多选题"
Text1.Text = "Word多选题"
Case "判断题"
Text1.Text = "Word判断题"
End Select
end if
If TreeView3.Nodes.Count > 0 Then
Select Case TreeView3.SelectedItem
Case "单选题"
Text1.Text = "Excel单选题"
Case "多选题"
Text1.Text = "Excel多选题"
Case "判断题"
Text1.Text = "Excel判断题"
End Select
End If

这样写
------解决方案--------------------


本帖最后由 bcrun 于 2012-11-18 12:39:25 编辑

If TreeView1.Nodes.Count > 0 Then
Select Case TreeView1.SelectedItem
Case "单选题"
Text1.Text = "信息单选题"
Case "多选题"
Text1.Text = "信息多选题"
Case "判断题"
Text1.Text = "信息判断题"
End Select
Else If TreeView2.Nodes.Count > 0 Then
Select Case TreeView2.SelectedItem
Case "单选题"
Text1.Text = "Word单选题"
Case "多选题"
Text1.Text = "Word多选题"
Case "判断题"
Text1.Text = "Word判断题"
End Select
Else If TreeView3.Nodes.Count > 0 Then
Select Case TreeView3.SelectedItem
Case "单选题"
Text1.Text = "Excel单选题"
Case "多选题"
Text1.Text = "Excel多选题"
Case "判断题"
Text1.Text = "Excel判断题"
End Select
End If

读书人网 >VB

热点推荐