Private Sub Command1_Click() If TreeView1.SelectedItem.Parent Is Nothing Then MsgBox "没有父结点!", vbInformation Else MsgBox "有父结点!", vbInformation End If End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then Command1.Value = True '相当于按Command1按钮 End If End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then call Command1_click'相当于按Command1按钮 End If End Sub
If TreeView1.SelectedItem.Parent Is Nothing Then
MsgBox "没有父结点!", vbInformation
Else
MsgBox "有父结点!", vbInformation
End If
End Sub
If KeyAscii = 13 Then
Command1.Value = True '相当于按Command1按钮
End If
End Sub
If KeyAscii = 13 Then
call Command1_click'相当于按Command1按钮
End If
End Sub
然后调用按钮的点击事件,Command1.Value = True(相当于按Command1按钮)
哪不明白啊~~