请问如何用方向键控制一组ComboBox 控件之间的焦点移动.当点击"vbKeyLeft"实现焦点上移,但是不能让ComboBox中的选中象上移,即不能让ComboBox的Text改变,当点击"vbKeyRight"实现焦点下移同样ComboBox的Text不变.(或着在一组Option中...)

解决方案 »

  1.   

    Dim s As String
        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当然还要还要处理一下例外了。
      

  2.   

    Private Sub Combo1_KeyDown(KeyCode As Integer, Shift As Integer)
     If KeyCode = vbKeyLeft Then SendKeys ("{TAB}")
    End Sub
      

  3.   

    Private Sub Combo1_KeyDown(KeyCode As Integer, Shift As Integer)
     If KeyCode = vbKeyLeft Then Combo2.SetFocus
    End Sub
      

  4.   

    相信上面的各位都没试过
    '********************************************************************************************
    '
    '   関数名  : (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
      

  5.   

    还可以在keydown中,直接把keycode =0就行了,不过这是ComboBox
    在Option 组中就不太好做了,它根本不响应keydown keypress 和keyup事件,所以只有在完成value下移后,才可以在LostFocus中用GetKeyState捕捉到此事件.而在此时,不能设置me.vlaue=true!哎,哪位高手help me!