For i = 0 To Combo1.ListCount If Combo1.List(i) = s Then Combo1.Text = Combo1.List(i + 1) End If Next当然还要还要处理一下例外了。
Private Sub Combo1_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyLeft Then SendKeys ("{TAB}") End Sub
Private Sub Combo1_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyLeft Then Combo2.SetFocus End Sub
相信上面的各位都没试过 '******************************************************************************************** ' ' 関数名 : (LlbSetComboArrowPress) ' ' 処理概要: ' ' 引数 : ' ' 戻り値 : ' ' 備考 : ' '******************************************************************************************** Private Sub LlbSetComboArrowPress(cNowCombo As ComboBox, oPrioObject As Object, oNextObject As Object, iKeyCode As Integer)
Select Case iKeyCode
Case vbKeyLeft If cNowCombo.listIndex = cNowCombo.ListCount - 1 Then iKeyCode = 0 ElseIf cNowCombo.listIndex < cNowCombo.ListCount - 1 Then cNowCombo.listIndex = cNowCombo.listIndex + 1 End If
If oPrioObject.Visible = True Then oPrioObject.SetFocus End If
Case vbKeyRight If cNowCombo.listIndex < cNowCombo.ListCount - 1 Then cNowCombo.listIndex = cNowCombo.listIndex - 1 End If If oNextObject.Visible = True Then oNextObject.SetFocus End If End SelectEnd Sub
Dim i As Integer
s = Combo1.Text
For i = 0 To Combo1.ListCount
If Combo1.List(i) = s Then
Combo1.Text = Combo1.List(i + 1)
End If
Next当然还要还要处理一下例外了。
If KeyCode = vbKeyLeft Then SendKeys ("{TAB}")
End Sub
If KeyCode = vbKeyLeft Then Combo2.SetFocus
End Sub
'********************************************************************************************
'
' 関数名 : (LlbSetComboArrowPress)
'
' 処理概要:
'
' 引数 :
'
' 戻り値 :
'
' 備考 :
'
'********************************************************************************************
Private Sub LlbSetComboArrowPress(cNowCombo As ComboBox, oPrioObject As Object, oNextObject As Object, iKeyCode As Integer)
Select Case iKeyCode
Case vbKeyLeft
If cNowCombo.listIndex = cNowCombo.ListCount - 1 Then
iKeyCode = 0
ElseIf cNowCombo.listIndex < cNowCombo.ListCount - 1 Then
cNowCombo.listIndex = cNowCombo.listIndex + 1
End If
If oPrioObject.Visible = True Then
oPrioObject.SetFocus
End If
Case vbKeyRight
If cNowCombo.listIndex < cNowCombo.ListCount - 1 Then
cNowCombo.listIndex = cNowCombo.listIndex - 1
End If If oNextObject.Visible = True Then
oNextObject.SetFocus
End If
End SelectEnd Sub
在Option 组中就不太好做了,它根本不响应keydown keypress 和keyup事件,所以只有在完成value下移后,才可以在LostFocus中用GetKeyState捕捉到此事件.而在此时,不能设置me.vlaue=true!哎,哪位高手help me!