投稿日 | : 2004/08/04(Wed) 14:08 |
投稿者 | : kamurin |
Eメール | : kamurin@hotmail.com |
URL | : |
タイトル | : Re: コンボボックスでの↑↓キー |
グローバル変数でFlgを作って、
cbo1で↑↓を押した時にFlgを立てて、
Flgが立ってる時にcbo1のClickが発生したら、
フォーカスをcbo1にセットしてみてはどうでしょうか
例
Private Sub cbo1_KeyPress(KeyAscii as Interger)
IF KeyAscii = 13 Then
cbo2.Enabled = True
cbo2.SetFocus
Elseif KeyAscii = vbKeyUP Or KeyAscii = vbKeyDwon Then
Flg=True
End If
End Sub
Private Sub cbo1_click()
If Flg=Ture then
cbo1.SetFocus
Else
cbo2.Enabled = True
cbo2.SetFocus
End If
Flg=False
End Sub
コンボボックスのKeyPressで↑↓が取れるか試してないけど、
もしダメなら、
フォームのKeyPressで取って、
Private Sub Form_KeyPress(KeyAscii As Integer)
if Me.ActiveControl.Name="cbo1" Then
if KeyAscii = vbKeyUP Or KeyAscii = vbKeyDwon Then
Flg=True
End If
End If
End Sub