2

KeyPressのフォーカスを変更するために Eventを使用しましたTextBox。オプションを使用するまでAutoCompleteは問題なく動作しますが、その後は動作しません。

のコードKeyPress:

If Asc(e.KeyChar) = 13 Then
            txtQuantity.Focus()
            txtQuantity.SelectAll()
            lastTxtBox = "name"
End If

のコードTextBox:

txtProductCode.AutoCompleteMode = AutoCompleteMode.Suggest
txtProductCode.AutoCompleteSource = AutoCompleteSource.CustomSource

両方の提案オプションを使用したい。キープレスをkeyDownに変更してみましたが、それでも機能しません。誰にも理由はありますか?

4

1 に答える 1

0

KeyDown代わりにイベントを使用してください:

Private Sub TB_KeyDown(sender As Object, e As KeyEventArgs) Handles txtProductCode.KeyDown
    If e.KeyCode = Keys.Enter Then
        txtQuantity.Focus()
        txtQuantity.SelectAll()
    End If
End Sub

それは私にとって完璧に機能します(テスト済み)。

于 2013-01-25T13:05:53.873 に答える