怎样用VB实现只用键盘而不需用鼠标点击就实现将dtpicker.checkbox的属性设为true.  还有我对dtpicker使用keypress属性时,当setfocus在其checkbox时,按enter键,setfocus会跳到下一个控件,但当setfocus位于dtpicker的日期数字时,按enter却没有反应,怎么回事呢?

解决方案 »

  1.   

    谁要你按enter啊?
    按空格试试
      

  2.   

    Private Sub Check1_KeyPress(KeyAscii As Integer)
    你实在想用enter也行:
    If KeyAscii = 13 Then
        If Check1.Value = 1 Then
        Check1.Value = 0
        ElseIf Check1.Value = 0 Then
        Check1.Value = 2
        ElseIf Check1.Value = 2 Then
        Check1.Value = 1
        End If
    End If
    End Sub
      

  3.   

    If KeyAscii = 13 Then
        Me.DTPicker1.SetFocus
    End If
      

  4.   

    xiaoyuanzhi(大侠) 说得好, 我爱听!
      

  5.   

    怎样用VB实现只用键盘而不需用鼠标点击就实现将dtpicker.checkbox的属性设为true.
    ------------------------------------------------------------------------------Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = vbKeyF1 Then DTPicker1.CheckBox = Not DTPicker1.CheckBox
    End SubPrivate Sub Form_Load()
    Me.KeyPreview = True
    End Sub按F1试试
      

  6.   

    当setfocus位于dtpicker的日期数字时,按enter却没有反应
    ---------------------------------------------------
    Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = vbKeyReturn Then SendKeys "{tab}"
    End Sub
      

  7.   

    //xiaoyuanzhi(大侠) 说得好, 我爱听!呵呵,多谢多谢,过奖过奖!