VB中的Combox如何在鼠标移动到某项时就将此项显示到文本框?

2025-01-05 07:51:14
推荐回答(3个)
回答1:

Private Sub Combo1_GotFocus()
Timer1.Enabled = True
End Sub
Private Sub Combo1_LostFocus()
Timer1.Enabled = False
End Sub
Private Sub Form_Load()
Timer1.Enabled = False
Timer1.Interval = 1
End Sub
Private Sub Timer1_Timer()
If Combo1.ListIndex = -1 Then Exit Sub
Combo1.Text = Combo1.List(Combo1.ListIndex)
End Sub

回答2:

加个timer控件

Private Sub Form_Load()
Timer1.Interval = 100
End Sub

Private Sub Timer1_Timer()
Me.Caption = Combo1.List(Combo1.ListIndex)
End Sub

回答3:

找一下Tip属性试试