Article View: fj.lang.visualbasic
Article #570Re: 標準のコンボボックスでの入力文字数制限に付いて
From: Sato Masahiro
Date: Wed, 25 Feb 1998 00:00
Date: Wed, 25 Feb 1998 00:00
31 lines
1463 bytes
1463 bytes
In article <6d0k75$r2i$1@nn-os001.ocn.ad.jp>, Kuniyoshi Mohri wrote:
>VB5の標準のコントロールのコンボボックスで、
>.Styleが0(ドロップダウンコンボ)のとき、入力する文字数を制限するには
>どうしたらよろしいのでしょうか?
面白そうなので、ちょっと考えてみました。
Private Sub Combo1_KeyPress(KeyAscii As Integer)
Const MAXLEN As Integer = 10
Dim InputLen As Integer
Select Case KeyAscii
Case 22: InputLen = Len(Clipboard.GetText())
Case 0 To 31: InputLen = 0
Case Else: InputLen = 1
End Select
If Len(Combo1.Text) - Combo1.SelLength + InputLen > MAXLEN Then
KeyAscii = 0
End If
End Sub
ぱっと思い付いたコードなので、やらなければいけない処理が
他にもあるかもしれません。
--
Computer Institute of Japan, Ltd.
佐藤正宏 masahiro@cij.co.jp
Technical Details
Message-ID:
<6d0qrq$7ab$1@hawaii.ykhm.cij.co.jp>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<6d0k75$r2i$1@nn-os001.ocn.ad.jp>Show Full Headers
Complete Article Headers
X-Google-Language: Japanese,JIS X-Google-Thread: 105c2e,f56fb090110a2966 X-Google-Attributes: gid105c2e,public From: masahiro@cij.co.jp (Sato Masahiro) Subject: Re: 標準のコンボボックスでの入力文字数制限に付いて Date: 1998/02/25 Message-ID: <6d0qrq$7ab$1@hawaii.ykhm.cij.co.jp> X-Deja-AN: 328462858 References: <6d0k75$r2i$1@nn-os001.ocn.ad.jp> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-2022-JP Organization: Computer Institute of Japan, Ltd. Newsgroups: fj.lang.visualbasic